Ask your WordPress questions! Pay money and get answers fast! (more info)

Overhead Database! WordPress

Hi there,

1. I'm been having a lot problems with Dreamhost Servers...(Slow/Down/Internal server error) I'm about to change to a new host (VPS)! Any advice?? I'm thinking on GoDaddy or HostGator... My average traffic is 2000 absolutes visitors per day. My goal is 15k in the next months.

2. My main question is.... My theme is generating 90+ queries over the frontpage/single/pages and everything... its suppose to have -35 queries over the frontpage. You can take a look to the website at [[LINK href="http://www.holapolitica.com"]]holapolitica.com[[/LINK]]

So here is the code... Who can clean this mess and give some advices on not overheading the database. I don't like to use plugins but using these ones right now W3 Total Cache / WPtouch Pro / WP-DBManager / WP No Category Base / Advanced Text Widget


Sorry about my English..


Some code was here...

Answers (7)

2013-03-04

Abdelhadi Touil answers:

Hi.
I think it'll be better to have access to your website dashboard to have a look and optimize your website. For webhosting I think Hostgator is good.
Good luck.

2013-03-04

Gabriel Reguly answers:

Hi,

1. Give a try with either http://wp-engine.com or http://rocketprezz.com.br

2. Please, install http://wordpress.org/extend/plugins/p3-profiler/ and tell the results.

Regards,
Gabriel


Hola Politica comments:

I didnt know about this plugin, I really like it, here is the results

First Scan:

Advanced Metrics
Total Load Time: 20.1866seconds avg.
Site Load Time 13.2061seconds avg.
Profile Overhead: 6.9805seconds avg.
Plugin Load Time: 4.4293seconds avg.
Theme Load Time: 4.1132seconds avg.
Core Load Time: 4.6280seconds avg.
Margin of Error: 0.0357seconds avg.
(20.1866 observed, 20.1509 expected)
Visits: 2
Number of PHP ticks: 3,163 calls avg.
Memory Usage: 35.38 MB avg.
MySQL Queries: 87 queries avg.

Second Scan, After disabling WPtouch Pro, W3 Total Cache and using Absolute Path


Advanced Metrics
Total Load Time: 9.3029seconds avg.
Site Load Time 7.2193seconds avg.
Profile Overhead: 2.0836seconds avg.
Plugin Load Time: 1.0033seconds avg.
Theme Load Time: 3.0104seconds avg.
Core Load Time: 3.1556seconds avg.
Margin of Error: 0.0499seconds avg.
(9.3029 observed, 9.2529 expected)
Visits: 4
Number of PHP ticks: 615 calls avg.
Memory Usage: 27.44 MB avg.
MySQL Queries: 82 queries avg.

Well, right now I just got from work, I will check more deeply this issue now!

2013-03-05

Plugarized answers:

Hola

Creo que lo mejor seria un Content Delivery Network (CDN)

Por otro lado podrias reducir los database request si usas el absolute path de ciertos archivos como por ejemplo en tu header


<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="http://www.holapolitica.com/feed/" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/dropdown.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/ie6.css" /><![endif]-->
<!--[if IE 7 ]><link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/ie7.css" /><![endif]-->


<strong>remplazas el <?php bloginfo('stylesheet_directory'); ?> por la direccion absoluta</strong>

<link rel="alternate" type="application/rss+xml" title="Hola Política RSS Feed" href="http://www.holapolitica.com/feed/" />
<link rel="pingback" href="http://www.holapolitica.com/xmlrpc.php" />
<link rel="stylesheet" type="text/css" href="http://www.holapolitica.com/wp-content/themes/holapolitica/style.css" media="screen" />
<link rel="stylesheet" href="http://www.holapolitica.com/wp-content/themes/holapolitica/css/dropdown.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="http://www.holapolitica.com/wp-content/themes/holapolitica/css/ie6.css" /><![endif]-->
<!--[if IE 7 ]><link rel="stylesheet" type="text/css" href="http://www.holapolitica.com/wp-content/themes/holapolitica/css/ie7.css" /><![endif]-->


Si utilizas la direccion absoluta en ves de hacer un request con <?php bloginfo('stylesheet_directory'); ?> te haorras varios mysql queries

De todas formas con el total cache que tienes eso convierte todas las paginas a html y tus usuarios van a ver una pagina cached en ves de php.

Pero lo mejor de todo seria un CDN


Hola Politica comments:

Me gusta mucho todas sus ideas ... ya hice lo absolute path y pude bajar unos queries mas, en este momento estoy aprendiendo más acerca de Content Delivery Network (CDN)

2013-03-05

Francisco Javier Carazo Gil answers:

Hi,

If you are using a shared hosts, you cannot use advanced solutions like Varnish, that solve this problem perfectly, if you are in a VPS or dedicated, use it.

Well if we cannot use Varnish, you can act in two ways.

Firstly, do as LatinUnit says and substitute in your header.php all get_option by a static value. Yes, you can do it in every value that is always the same: rss url, charset, language, etc. In this same direction, install P3 Profiler and look if there is a special load from a plugin.

Secondly, install a cache. I recommend you http://wordpress.org/extend/plugins/wp-super-cache/ and configure it. The best option to be able to receive more visits with security, is the .htaccess one.

Finally, if after all this, you have more than 15k visits and you want to offer a good service, user Varnish, I can tell you how, I have clients with thousends of visits and no problem, it's like a SuperCache plugin but in a low level and you scale as much as you want using only a little server.

2013-03-05

triben answers:

You are using awfully alot of query_posts. It creates a bunch of queries because it creates a new wp_object each time hence its costly in queries and plays with the main query. Use pre_get_posts in a function with transients (wordpress way o putting html directly in the database and getting it when needed, one query for the whole html of the list of posts per example). For examples use the link and follow at the end the code and modify for your own need. http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/


Hola Politica comments:

Thanks

2013-03-05

MDan answers:

If you are reffering at what phpMyAdmin calls overhead, you may get rid of the overhead by running OPTIMIZE TABLE command that will compact your table and indexes.
See this for start: http://wpmu.org/wordpress-maintenance-101-how-to-optimize-and-repair-database-tables/
Also a good post on Overhead: http://www.inforats.com/optimize-your-mysql-database-clear-overhead/

Make a BACKUP before doing any changes!

2013-03-05

Jarret Minkler answers:

Don't waste your $$ to get a VPS, all you will do is run slow plugins on a faster server.

You need to figure out what is making the calls. Check http://wordpress.org/extend/plugins/debug-queries/

I usually do WP "speed ups" for @ $150 USD


Hola Politica comments:

Dude, you've beaten the beast!! Now I have a lot things to do check. I'm thiking to make the speed up after this...but let thing about it.

Is there some way that I can up vote you!!


Thank you!! Thank you!! Thank you!! Thank you!! Thank you!!


Jarret Minkler comments:

Yes, you can add bonus in acceptance, can contact me as well via messages