Possible to optimize script for blog/archives get/posts?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
adensmore
Regular
Posts: 7
Joined: Tue Jun 08, 2010 10:06 pm

Possible to optimize script for blog/archives get/posts?

Post by adensmore »

Hi,

I've had a s9y blog integrated into a client's website for roughly 6 years now, here:
http://www.gulfcoastmag.org/blog

Lately, the server it is hosted on is crashing and my admins claim it is due to "multiple apache/php connections for the account gulfcoas" -

(continuing):

"The log entry "GET/POST request for /blog/archives/" suggests that there were php access requests for the pages in directory blog/archives/ We recommend contacting your website developer and optimize the script so that the php requests for the site can be minimized."

I have in fact seen from running "top" at the shell that the entire server load some evenings is due to gulfcoas connections. We troubleshooted for a while a China traffic issue but it appears after firewalling all China traffic that was not the issue - the server loads still climb too high with gulfcoas connections and then it basically crashes (websites can't load).

I know with WordPress, I'm able to use "caching" to create a bunch of files that tremendously reduce server load and actual php processing etc.

Is there an equivalent/comparable approach for the s9y blog archives?

OR, does this analysis by my admins even make sense or sound familiar at all?

I'm not technical enough to really understand much more than what I asked, I tried to search the forums for info related to this but didn't find anything - I apologize if I'm posting in the wrong place or if this info is out there somewhere obvious etc..

Thanks for your time and any advice/help!
Alan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Possible to optimize script for blog/archives get/posts?

Post by garvinhicking »

Hi!

Well, the blog/archives/ page list is of course a database heavier operation, since it queries all 6 years of blog entries for you. If maybe "malicious" people request this URL fairly often, there are a couple of solutions that come to my mind:

- Maybe block the IP (ranges) that often request this page
- If you don't really require this page, you could block it by adding a .htaccess rewrite from /blog/archives/ to the startpage /blog/
- You might want to add a frontend proxy caching server like Varnish to optimize the output caching of the page. Serendipity itself doesn't have that caching functionality as of now internally; we tried to get some results with the serendipity_event_cachesimple plugin (which you might want to try), but this still hits the database for several queries.

HTH,
Garvin
# 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/
adensmore
Regular
Posts: 7
Joined: Tue Jun 08, 2010 10:06 pm

Re: Possible to optimize script for blog/archives get/posts?

Post by adensmore »

Garvin, that all makes sense, I don't have a specific followup yet but I'm gonna work on some of those things for now and see where I can get! Thank you very much, I really appreciate it !!
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Possible to optimize script for blog/archives get/posts?

Post by Timbalu »

Without having looked into, couldn't we (by option) cache this full archives query result for a day or so and deliver the result by timestamp? There is no actual need to have the archives build live on every request, is it?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Possible to optimize script for blog/archives get/posts?

Post by garvinhicking »

Timbalu wrote:Without having looked into, couldn't we (by option) cache this full archives query result for a day or so and deliver the result by timestamp? There is no actual need to have the archives build live on every request, is it?
Well, of course every hour or so a new blog post for the recent month could be added to the list, or an old blog entry could be deleted. We would need a lot of work to invalidate the cache on specific events.

Having caching like this would be neat, but currently we have no "framework" for this kind of caching logic.

The cachesimple plugin tries/tried to do that, but if proved really complicated.

Regards,
Garvin
# 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/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Possible to optimize script for blog/archives get/posts?

Post by Timbalu »

Yes, I'd expect this is complicated.

Though I still think it could be worth doing, since I know sites which are bombed by (bot/bookmarked) archive requests, since having had the calendar and the archive sidebar plugins enabled over years.
Regards,
Ian

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