PDA

View Full Version : Stock Market server problems


SqueaL
01-07-2006, 07:14 AM
If I can suggest something to help the server with the stockmarket issue.

It seems that every time a player refreshes the page the PHP script has to make a stack of SQL calls etc. Why done to make the script that recalcuates the stock values every 5 mins generate a static html page with the current values on. Also make it like a popup window with only the stock values on and not the right hard side bar that has all the players cities, troops and other info that takes more sql calls and in turn lags the server.

With more people joining the game is going to lag more and more. Using static pages will help a lot. I've used them extensively on my dynamic websites in similar situations.

Regards
SqueaL

Hellman109
01-07-2006, 07:29 AM
Ive also suggested an XML feed with the information which would also drastically reduce the amount of data and processing needed.

I agree that something needs to be done though, static pages sounds like a great idea, with the only problem being the number of shares you can buy would need to be dynamic, Im sure something could be worked out there though (you click buy, and that page is dynamic with the number you can afford, for instance)

SqueaL
01-07-2006, 09:14 AM
I agree that something needs to be done though, static pages sounds like a great idea, with the only problem being the number of shares you can buy would need to be dynamic, Im sure something could be worked out there though (you click buy, and that page is dynamic with the number you can afford, for instance)

Yes, what I reccommend is that the the process of viewing the current prices and the buying get separated. I'm sure most of the hits the stock page gets are from people checking for price updates. They don't need to know how many shares they can get for their geos at that stage.

Luke
01-07-2006, 12:46 PM
That is actually not such a bad idea.

hardcode
01-07-2006, 01:11 PM
I suggested the same last night. Generating the stock price page should hit the database one time only, once every 5 minutes and there maybe other pages this is applicable to.

Another suggestion would be to have a date field in some tables and do a lightweight "has this data changed since we last generated the page" request before hitting the database with a more stressful query.

Only truely dynamic pages should be dynamic!

hardcode