-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
midgard_config::open_config is slow #116
Comments
midgard_connection::open_config is expensive. It initializes many internal structures (apart from database connection). Do you use httpd server? |
Yes, I'm running Apache with multiple vhosts. So each vhost has midgard.configuration set, but for some reason, |
P.S.: I understand that |
This is weird. The most expensive part of config_open is parsing schema files, but this should be already done in php extension. Even if it is not(for unknown reason), parsing should be done once per process, because classes are registered in GType system. Some time ago I did some benchmarks and host with Midgard2 connection was able to serve much more connections then the one with Midgard1. Mostly due to vhost configuration in apache. Make sure max request per child is high in vhost. It's a key to keep connection alive as long as possible. Do you have any warnings or errors in apache's error log? False is_connected() seems bad and it looks like connection hasn't been initialized at all for that vhost. If there's nothing in error log, set debug in MySQL (restart it) and restart apache. MySQL logs should tell anything about any connection attempts. Establishing connection in apache is done during server startup. |
Quick look at code makes me feel that is_connected() might be always false in apache environment. Did you check if you are able to query any object when is_connected() returned false? |
I just checked by calling If I call QB before
If I call it afterwards, I get nothing |
Some more stuff I stumbled upon:
|
OK. midgard.http set to Off explains why there's no connection available. It must be set On for apache httpd.
and when it crashes:
And paste backtrace. |
OK, I've tried that now and get the following:
When I disable xdebug, the segfault goes away and the site loads normally with |
What midgard-php5 tarball did you use? |
I'm using latest git master (868ee23) |
P.S: I don't know if this has anything to do with the recompile I did today or not, but I just noticed that I'm getting segfaults on one of my other vhosts:
This only happens when |
This is separate issue. |
I recently did some profiling on openpsa requests with Cachegrind and to my surprise, it turned out that the single most expensive function called is usually midgard_config::open_config(). for example, in AJAX requests, where there is not much going on in the framework level (no navgiation rendering, only very simple styling), open_config accounts for more than 80% of the total request time. In normal requests, open_config uses 30 - 50% of the total time.
This was tested in a VM on Ubuntu 13.04 with PHP 5.5.3 with a MySQL database running locally (using gda5). Unfortunately, in Cachegrind, I cannot see what happens inside of open_config(), so I was wondering: Is there any way to find out what is taking so much time? Also, is there any way to speed this up?
The text was updated successfully, but these errors were encountered: