Performance penalty from multilingual plugin

Creating and modifying plugins.
Post Reply
User avatar
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Performance penalty from multilingual plugin

Post by wesley » Mon Apr 18, 2016 9:05 am

This is something I've been noticing for about a decade, but never really got around to thinking about it until now. I was recently trying to optimize the site performance by tweaking things here and there, but one thing I wasn't able to cut down was the time it takes for the site to respond to the request to load the front page.

Basically, it takes about 4 seconds until the site responds and sends something to the user's browser. No optimizations on the PHP or DB(MySQL) end had any noticeable effects. The site now loads pretty quickly once the server responds, though.

Then I was fiddling around with the s9y plugins and accidentally removed the multilingual entries plugin. When I did this, the response time was reduced to around 1 second. In other words, having multilingual support imposes about 3 seconds of server response penalty because s9y is doing something to prepare multilingual support.

I was wondering if there are any ways of improving this.
I make s9y plugins, too.
My s9y blog depends on them. :)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Performance penalty from multilingual plugin

Post by Timbalu » Mon Apr 18, 2016 10:56 am

wesley wrote:I was wondering if there are any ways of improving this.
No.
This, while it is done per request. The more places you have to check for multilingual tags, the more it will take.
Generally Plugins slow down down your system. The more you have, the more there is to do. In special those, like this, who have to modify the delivered content.
The only thing I would see to tweak is a faster server access, being more than your locally in-bound mac-mini.
Normal web servers have at least 100 Mbit/s, near a fast Internet Exchange knot. And maybe use PHP7 which increases performance too (which is not fully tested yet with S9y though!).

Please stop your dancing badger. I am not really willing to see this every time I have to read and answer your posts. Please! :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2241
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Performance penalty from multilingual plugin

Post by onli » Mon Apr 18, 2016 11:26 am

We added a database cache to the current development version. It should help getting the response time down.

In general, the best thing you could do it to profile the performance and see where the time is spent. Often enough you can identify which function or database query takes the most time and optimize it.

User avatar
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Re: Performance penalty from multilingual plugin

Post by wesley » Mon Apr 18, 2016 11:58 am

Thank you for the responses. The issue indeed seems to be an inherent characteristics of the plugin. When the development version of s9y becomes stable, I'll try it out and report on the results.
Timbalu wrote: The only thing I would see to tweak is a faster server access, being more than you locally in-bound mac-mini.
Normal web servers have at least 100 Mbit/s, near a fast Internet Exchange knot. And maybe use PHP7 which increases performance too (which is not fully tested yet with S9y though!).
With the plugin removed, the response time is around quite reasonable 1 second as I stated above. So I don't think a faster connection would alleviate the issue. Besides, the connection I get at home had been 100Mbps for several years. Thanks for the suggestion, though. The ISP does offer 1Gbps connection, but I fear it won't help in this situation.
I make s9y plugins, too.
My s9y blog depends on them. :)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Performance penalty from multilingual plugin

Post by garvinhicking » Fri Apr 22, 2016 9:39 am

It would be interesting to analyse this more deeply and add some timing/profiling to see where exactly the server seems to idle.

It could be extra SQL queries which are performed, because otherwise I'm stumped that 2 seconds add up. The plugin performs a few regexps, but those should only me microseconds, not seconds.

A PHP tool like XDebug can create cool valgrind outputs with a PHP flowchart, which we could compare easily once with and once without the plugin. Any chance you are able on your host or a dev setup to enable the xdebug extension? (https://xdebug.org/)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Re: Performance penalty from multilingual plugin

Post by wesley » Fri Apr 22, 2016 1:18 pm

I can install the xdebug extension, but I would need some help in configuring it to get the necessary output.
I make s9y plugins, too.
My s9y blog depends on them. :)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Performance penalty from multilingual plugin

Post by garvinhicking » Fri Apr 22, 2016 1:37 pm

wesley wrote:I can install the xdebug extension, but I would need some help in configuring it to get the necessary output.
I'd be happy to try to help. I've done this about 4 years ago, but it's actually not so hard.

http://devzone.zend.com/1139/profiling- ... th-xdebug/ is actually still valid I think; you only need to enable xdebug.profiler_enable=On in php.ini, then run the application, and you will get a file for each HTTP request within your xdebug.profiler_output_dir directory.

This profile file you can load into a tool like (k)valgrind, and it will show you a graph where you can see where most time was spend on which PHP function call.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply