Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Webpages load slowly...
PostPosted: Fri Aug 22, 2014 2:11 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
1GB ram, LAMP, just one wordpress site using classipress theme with over 30k ads and lot of content, with mysql db 500+ mb large, always about 15-30 visitors on site at every moment (looking at google analitics live preview), sometimes more.

Now, website is working, but pages are loading slow, sometimes very fast, and other times it takes 20+ seconds to open a page, and sometimes a blank page is open.

I run free -m when page is loading slow and get something like this:

total used free shared buffers cached
Mem: 1001 919 82 21 42 553
-/+ buffers/cache: 323 678
Swap: 1023 31 992

if I understand right, this means I have 678 mb free. Then what is the problem why are pages loading so slow most of the times ?

Some of the settings I have:

keep alive - OFF

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxRequestWorkers 10
MaxRequestsPerChild 0
</IfModule>

in my.cnf

key_buffer = 64M
max_allowed_packet = 1M
thread_stack = 64K
thread_cache_size = 8
myisam-recover = BACKUP
table_cache = 8
query_cache_limit = 1M
query_cache_size = 16M

in error.log i have errors like

Maximum execution time of 30 seconds exceeded in.... and sometimes pages open blank, nothing there...

and also

server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting, but I tried that and it did not worked.

Any help would be appreciated!


Top
   
PostPosted: Sun Aug 24, 2014 5:06 pm 
Offline
Linode Staff

Joined: Mon Aug 18, 2014 2:43 pm
Posts: 35
Website: https://levlaz.org
Location: Absecon, NJ
Hello!

Have you tried changing the settings for apache and mysql to match the recommended settings in the Linode "Hosting a Website" guide [1]? They are optimized for a 1GB Linode.

Apache
--------

KeepAlive Off

---

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>

MySQL
--------
max_connections = 75
key_buffer = 32M
max_allowed_packet = 1M
thread_stack = 128K
table_cache = 32

Best,
Lev

[1] https://www.linode.com/docs/websites/ho ... linode-1gb

_________________
Best,
Lev
https://levlaz.org


Top
   
PostPosted: Thu Aug 28, 2014 6:09 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
yes, and still the same, page loads for 30 seconds most of the time...


Top
   
PostPosted: Sat Aug 30, 2014 9:40 am 
Offline
Senior Newbie

Joined: Mon Mar 31, 2014 2:29 pm
Posts: 19
AndrijaM wrote:
yes, and still the same, page loads for 30 seconds most of the time...

First, check on your cache plugin to see if it is working…I think most of them put an HTML comment in at the bottom of every page load so you can see what it's doing (check when NOT logged in to WP site).

You have a PHP script that is timing out, I don't think this is a memory issue. Try disabling all non-essential plugins and seeing what happens.


Top
   
PostPosted: Sun Aug 31, 2014 10:15 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
I disabled all plugins, but nothing changed, do not use cache plugin at all (not like wordpress cache plugin, but I did install php-apc) , you thing that might help me ?


Top
   
PostPosted: Sun Aug 31, 2014 3:18 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Using some form of cache is almost always good.
- APC speeds up the PHP end of things, which is good for Wordpress.
- A Wordpress cache plugin is good because it makes Wordpress serve an html page rather than running all of the PHP.
- APC + Wordpress cache plugin together are better still.

Usually a Wordpress cache plugin will serve up cached results to visitors who are not logged in, and serve up fresh content to logged in visitors. I'm not sure of the lifespan of the cached entries, but it makes a big difference if your content isn't continually changing.

Keep in mind we don't know which distro you're running so APC may not be the right answer depending on your version of PHP.


Top
   
PostPosted: Thu Sep 04, 2014 3:13 pm 
Offline
Senior Newbie

Joined: Mon Mar 31, 2014 2:29 pm
Posts: 19
AndrijaM wrote:
I disabled all plugins, but nothing changed, do not use cache plugin at all (not like wordpress cache plugin, but I did install php-apc) , you thing that might help me ?

I think a working WordPress cache plugin will help you, yes, because it's much less processing to serve pages (usually). It's hard to say anything for sure without seeing your site. It's weird that you're exceeding script execution times even without plugins. My next guess without knowing any more information is that your wordpress installation could be compromised.


Top
   
PostPosted: Sun Oct 12, 2014 10:37 am 
Offline
Senior Newbie

Joined: Wed Sep 03, 2014 2:00 pm
Posts: 13
I use a 1GB Linode too and here's my apache mpm_prefork and apache.conf settings (handles lots of traffic great on 12 Wordpress blogs)

KeepAlive ON
MaxKeepAliveRequests 200
KeepAliveTimeout 2

StartServers 7
MinSpareServers 7
MaxSpareServers 14
MaxRequestWorkers 90
MaxConnectionsPerChild 0

You could also try switching to mpm_event with php5-fpm which works well for high traffic on some of my other servers.


Top
   
PostPosted: Thu Oct 16, 2014 9:43 pm 
Offline
Newbie

Joined: Wed Jul 30, 2014 11:00 am
Posts: 3
Install and configure varnish to run in front of Apache - A quick google turned up this tutorial, which will get you going... http://code.tutsplus.com/tutorials/opti ... -cms-21136

In addition to that, you might want to add the following code to your default.vcl and restart varnish.

In "sub vcl_recv" look for the section with req.request != "GET" and immediately underneath it add the code below - I've included the code your'e looking for for reference (don't duplicate it).

Code:
        if (req.request != "GET" && req.request != "HEAD") {
                /* We only deal with GET and HEAD by default */
                return (pass);
        }
        if (req.url ~ "\.(png|gif|jpg|swf|css|js)$"
                || req.url ~ "\.(css|js)\?[a-z]*=[0-9]*$") {
                unset req.http.cookie;
        }


This will strip cookies from images and css - you really don't need cookies and it stops varnish from caching the static files.

Then in "sub vcl_fetch" add this right at the very beginning:

Code:
        if(req.url ~"\.(png|gif|jpg|swf|css|js)$" ||
                req.url ~"\.(css|js)\?[a-z]*=[0-9]*$") {
                unset beresp.http.set-cookie;
                set beresp.ttl = 180s;
                set beresp.http.X-Cache = "HIT";
                return (deliver);
        }


This will remove the cookie from the response to the user's browser, set a TTL of 180s (so all your images / css / js only get loaded into memory every 2 minutes), and set an extra cache header so you can check that its working.

Hopefully that helps.

J.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group