ElkArte Community

General => Chit Chat => Topic started by: badmonkey on January 06, 2016, 08:59:12 am

Title: Mysql or Apache worker tuning
Post by: badmonkey on January 06, 2016, 08:59:12 am
Hi guys!  I have a question to address a couple of issues I'm having on an SMF install.  Hope that's OK here.

A fairly large site 1.1M posts, returns a 500 error when trying to access the stats page or search.  Otherwise the site is smoking fast.

The install is on a dual core VPS with 2G memory, apache worker, and sphinx search.  I suspect the issue lies with either apache or mysql tuning.   Anyone have pointers?  Where should I start?  Thanks!
Title: Re: Mysql or Apache worker tuning
Post by: emanuele on January 06, 2016, 09:16:43 am
I hope with "search" you mean not access the ?action=search page, but rather when waiting for the search results, right?
Title: Re: Mysql or Apache worker tuning
Post by: badmonkey on January 06, 2016, 11:37:49 am
Quote from: emanuele – I hope with "search" you mean not access the ?action=search page, but rather when waiting for the search results, right?

Ah, yes.  Thanks for pointing that out.  The error occurs awaiting the results. 
Title: Re: Mysql or Apache worker tuning
Post by: Joshua Dickerson on January 06, 2016, 01:32:15 pm
Did you check the error log? I don't know anything about Sphinx, but I'm sure it also has an error log.
Title: Re: Mysql or Apache worker tuning
Post by: Nifty on January 06, 2016, 01:38:29 pm
The Statistic Page is not accessing Sphinx as far as i can see. I would check the Apache (Error) Log files
Title: Re: Mysql or Apache worker tuning
Post by: badmonkey on January 06, 2016, 02:56:22 pm
Thanks guys.  The apache error logs are clear.  I can't help but think both symptoms hold a common root cause.  If so, sphinx is an unlikely culprit.  Could the apache memory limits be too low?
Title: Re: Mysql or Apache worker tuning
Post by: Allan on January 06, 2016, 03:21:42 pm
What are the memory limits you have it set to?
Title: Re: Mysql or Apache worker tuning
Post by: Joshua Dickerson on January 06, 2016, 03:38:19 pm
Your error log might not be setup correctly or you might be looking at the wrong one. When you hit an Apache/PHP memory limit it gets logged. Please post your httpd.conf and php.ini. MySQL shouldn't have anything to do with it but it's always a good idea to check that error log to make sure nothing bad is happening. It's a good idea to check all of your error logs, really.
Title: Re: Mysql or Apache worker tuning
Post by: emanuele on January 06, 2016, 06:18:47 pm
Maybe @Spuds in his role of Sphinx Master can have an idea. :P
Title: Re: Mysql or Apache worker tuning
Post by: Spuds on January 06, 2016, 08:20:52 pm
Seems like a 500 is going to be some PHP error

Look at phpinfo to see where its log is located and see if it has anything in it.   If its empty, you may need to set/add error_reporting = E_ALL in your php.ini (just add it at the end).  Then create the 500 error again and check the log (and be sure and remove the above line).  

It could also be sphinx, if you are running a version that is not compatible with the config file.  I think the smf one requires the separate api file, you have to get that from the sphinx distro.
Title: Re: Mysql or Apache worker tuning
Post by: badmonkey on January 06, 2016, 09:13:15 pm
Now I'm getting a warning in the error log:

PHP Warning:  set_error_handler() expects the argument (error_handler) to be a valid callback in /public_html/index.php on line 110


Not sure that would cause death and destruction upon a search, or in the stats.
Title: Re: Mysql or Apache worker tuning
Post by: Joshua Dickerson on January 06, 2016, 09:43:29 pm
What SMF version? No idea how your error handler got messed up. Is /Sources/Errors.php there and this line - https://github.com/SimpleMachines/SMF2.1/blob/d23bfa98183bfd23485d68c6032c3c0adf4bab4a/Sources/Errors.php#L210 is there? If it is, try commenting out that line in index.php and see if PHP logs the error properly.
Title: Re: Mysql or Apache worker tuning
Post by: badmonkey on January 08, 2016, 09:10:21 am
Quote from: Joshua Dickerson – What SMF version? No idea how your error handler got messed up. Is /Sources/Errors.php there and this line - https://github.com/SimpleMachines/SMF2.1/blob/d23bfa98183bfd23485d68c6032c3c0adf4bab4a/Sources/Errors.php#L210 is there? If it is, try commenting out that line in index.php and see if PHP logs the error properly.

Good call on the version - it is a 2.1 install.  Commenting that line in index.php results in the same error log entries.

Could there be a relationship to apache worker as opposed to apache prefork?  I made the switch recently......that's why I wondered if it could be tuning related.
Title: Re: Mysql or Apache worker tuning
Post by: Vekseid on January 16, 2016, 12:47:53 pm
I wrote a pretty comprehensive guide to Debian Wheezy a few years back:

http://hexwiki.com/wiki/Debian_Wheezy

Things are pretty much the same for Jessie, though I haven't made a specific guide for it yet.
Title: Re: Mysql or Apache worker tuning
Post by: Spuds on January 21, 2016, 02:47:25 pm
Very nice !
Title: Re: Mysql or Apache worker tuning
Post by: SpeedFreak on January 21, 2016, 07:09:26 pm
Isn't smf 2.1 the recent beta 2?
If so you should prolly report the issue at the the beta forums as well so they know bout it ;)
Title: Re: Mysql or Apache worker tuning
Post by: ahrasis on January 21, 2016, 08:11:00 pm
Quote from: badmonkey – Could there be a relationship to apache worker as opposed to apache prefork?  I made the switch recently......that's why I wondered if it could be tuning related.
I think this switch could be the reason. Have you try re-switching it?