D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] And you wonder why the tubes are blocked ...

 

On Tue, 2 Mar 2010, tom wrote:

The problem Gordon described is a simple one to solve:
check for a dirty bit, dont run the whole Stored Procedure (and if its not a stored procedure ask why!) just find out if the data has been updated - and return an empty recordset if it hasnt. Seriously easy in the worst ajax I've seen.

It's not quite like that, and I won't go into details... But there is a list of "stuff" which is simple text strings - lets call them sentences. This is pre-loaded into a database once a day with timestamps. Remote clients need to query the database to get the current sentence based on the time of day - so there's 2 parts to it, one is the MySQL query done local on the server, and one is the remote client making the request to the server to get that data.

Initially the remote client was making the request which was running php which was doing the database extraction - this at 100 clients once a second was starting to have a significant effect on the server, so it was changed with the extract happening once a minute to a text file, then the php servicing the client was just reading a text file - but what I didn't realise at the time was that the remote clients were still accessing it once a second. Expand this to 2 more sites of the same ilk - each with their own database, etc. and it's not that scalable. (Although the new one is on a separate server)

So I've asked them to change the client code to only query every 20 seconds or so and not every second. The time-significance of the data is that it changes once every 2-3 minutes, and it's not critical to the operation of the site, just a "nice to have".

The real issue is that their programmers are not programmers - they're mostly people who've picked it up as they've gone along. I have the benefit of 7 years in a university studying comp. sci, engineering & real-time control, and I'm an efficiency nut, so sometimes get a bit irritated by it all!

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html