Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject:
PostPosted: Thu May 12, 2011 4:31 pm 
Offline
Junior Member

Joined: Mon Apr 11, 2011 9:49 pm
Posts: 49
Cheek wrote:
Ugh, it seems I can do the same thing on my site. When visiting a lot of different pages that haven't been cached before, it slowly eats all the memory. A lot slower than Piwik, but it happens..

When testing with ab it's just one page, so I guess it's different when visiting a lot of different pages. Is this still apache's problem? Shouldn't it release the memory after the page has been sent?
Did you do this step.. ??

http://piwik.org/docs/setup-auto-archiv ... every-hour


Top
   
 Post subject:
PostPosted: Thu May 12, 2011 4:37 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
Cheek wrote:
Ok, so I guess the problem I described above is how apache is supposed to work.. It doesn't care about your memory?

Depends on what you mean by "doesn't care". If you mean will it obey the settings in terms of when to create new worker process and how long to let the same process service requests independent of what memory is being used, then yes. But it's not like it's malicious or anything :-)

Quote:
I've now settled on even lower settings. It seems to make some images load pretty slow, but at least the server doesn't seem to be crashing (yet).

That's your most important goal at this point. And from the sequence of posts it would seem like you're working your way to at least a safe set of settings, if not ideal for performance.

Once you've stopped the bleeding, so to speak, then you can start thinking about performance tweaks, while staying within your available resource. With lower MaxClients it does mean that each request may get delayed slightly until a worker process is free, which could be what you're seeing with the images.

The issue is that the same Apache worker pool is being used for both full scripting pages (running Drupal) as well as simple static files. So now, this is, for example, a place where considering steps like using nginx as your front-end server, proxying drupal portions of the site back to Apache, is reasonable.

That way, static content can be delivered quickly (and with very low memory overhead) from nginx, while everything else still goes through the full scripted/Apache route.

-- David

PS: On the piwik thing, I'm afraid I'm out of my depth as I have no experience with that. I find it hard to believe you're seeing unbounded process growth if you keep MaxRequestsPerChild low (and maybe 30 is even too high), but since I don't know what it does or how it works, I'd have to leave that aspect of things to someone else.


Top
   
 Post subject:
PostPosted: Thu May 12, 2011 4:43 pm 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
superfastcars wrote:
Cheek wrote:
Ugh, it seems I can do the same thing on my site. When visiting a lot of different pages that haven't been cached before, it slowly eats all the memory. A lot slower than Piwik, but it happens..

When testing with ab it's just one page, so I guess it's different when visiting a lot of different pages. Is this still apache's problem? Shouldn't it release the memory after the page has been sent?
Did you do this step.. ??

http://piwik.org/docs/setup-auto-archiv ... every-hour
Yes, but I don't think archiving is the problem. It's the connection the live widget keeps.

Anyway, with the latest settings I posted Piwik doesn't use up all my memory anymore. It does make the server a bit slow though I think..


Top
   
 Post subject:
PostPosted: Thu May 12, 2011 4:46 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Tip: Enable mod_expires and set the expires time for static elements to something high, that will reduce the number of requests on the server since the browser will cache the elements and not re-request them.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Thu May 12, 2011 4:52 pm 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
db3l wrote:
PS: On the piwik thing, I'm afraid I'm out of my depth as I have no experience with that. I find it hard to believe you're seeing unbounded process growth if you keep MaxRequestsPerChild low (and maybe 30 is even too high), but since I don't know what it does or how it works, I'd have to leave that aspect of things to someone else.

Thanks for all your advice David. You've been a great help! :) I think this will be good thread for other beginners in the future..

Any suggestions about the last settings I used?

It seems like StartServers, MinSpareServers and MaxSpareServers did the trick for the crashing. Because when I set MaxClients and MaxRequestsPerChild both to just 5, Piwik still managed to crash the server..

obs wrote:
Tip: Enable mod_expires and set the expires time for static elements to something high, that will reduce the number of requests on the server since the browser will cache the elements and not re-request them.

Thanks for the tip obs, I'll try that.


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 5:34 am 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
I've been running these settings for a little less than a week now:

Code:
<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       2
    MaxSpareServers       3
    MaxClients            9
    MaxRequestsPerChild  28
</IfModule>


But it turns out I was a little bit too optimistic.

The server still crashes. It's actually a miracle it worked for months without configuration.

So the 'ab' stress test didn't work and I just tried some random crawler on my site. It follows all links instead of just one url.

Turns out I can crash the server with any setting. Even when I set MaxClients and MaxRequestsPerChild to just 3.

The only thing setting the variables lower does, is making the process of filling up the memory slower.

I'm still baffled this is how it's supposed to work..

Are there any other settings I might have missed? Anything else I can try?

If any setting can eat up my memory, what can I do? A bigger node won't help, just delay the crash..


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 7:07 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
Can't find MySQL settings in this thread.
If I didn't missed them, show your my.cnf settings. MySQL can easily start swapping, with wrong settings.

There is part of example of settings for Linode 512:

Code:
low_priority_updates=1

#key buffer = 25% of memory size
key_buffer              = 100M
sort_buffer_size        = 2M
table_cache            = 512
max_heap_table_size     = 32M
tmp_table_size  = 32M
max_sort_length = 20

max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 20

query_cache_limit       = 10M
query_cache_size        = 16M
max_connections        = 50


Do not just copy this settings, use this script to get tips about tuning your configuration: http://www.day32.com/MySQL/tuning-primer.sh


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 7:56 am 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
I've made some changes to my.cnf, but every setting was set much lower, like in this tutorial:

http://library.linode.com/troubleshooti ... networking

In the taskmanager I can see it's apache eating up the memory. If it was a MySQL, it should be 'mysqld' process, am I right?


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 7:59 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
Settings from that tutorial can kill performance of MySQL and MySQL will become an IO-hog.


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 8:08 am 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
OZ wrote:
Settings from that tutorial can kill performance of MySQL and MySQL will become an IO-hog.

I've now set it to the settings you provided above. Ran the performance script and lowered max_connections. But still the memory builds up. Can mysql consume memory in the name of apache in the taskmanager?


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 8:20 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
Cheek wrote:
OZ wrote:
Settings from that tutorial can kill performance of MySQL and MySQL will become an IO-hog.

I've now set it to the settings you provided above. Ran the performance script and lowered max_connections. But still the memory builds up. Can mysql consume memory in the name of apache in the taskmanager?


No. In the name of apache can be php scripts. Press "c" in `top` - you will see commands with processes.


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 8:31 am 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
OZ wrote:
Cheek wrote:
OZ wrote:
Settings from that tutorial can kill performance of MySQL and MySQL will become an IO-hog.

I've now set it to the settings you provided above. Ran the performance script and lowered max_connections. But still the memory builds up. Can mysql consume memory in the name of apache in the taskmanager?


No. In the name of apache can be php scripts. Press "c" in `top` - you will see commands with processes.

Then it's definitely apache, not mysql..


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 9:00 am 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
what modules other than mod_php do you have enabled? If you have a bunch of extraneous ones, that will make apache take up more ram than it should


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 9:43 am 
Offline
Junior Member

Joined: Wed May 11, 2011 7:13 am
Posts: 32
glg wrote:
what modules other than mod_php do you have enabled? If you have a bunch of extraneous ones, that will make apache take up more ram than it should

You mean apache modules?

Nothing special:
Code:
  core.c
  mod_log_config.c
  mod_logio.c
  prefork.c
  http_core.c
  mod_so.c
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)


Top
   
 Post subject:
PostPosted: Wed May 18, 2011 11:56 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
I think reason in some of php-scripts.
What is your memory_limit in php.ini ? Try to set 20M there (or less).


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


Who is online

Users browsing this forum: No registered users and 0 guests


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