ztizzlegaming / CSGOWinBig

Open-source Counter-Strike: Global Offensive jackpot betting website.
MIT License
169 stars 104 forks source link

Need help with site performance #154

Closed linkzy closed 8 years ago

linkzy commented 8 years ago

When my site gets arround 10 to 15 players betting at the same time, it becames super slow.

Deposits are taking up to 30 seconds... and if you count the time that the user takes to get a response and update the page it takes 40 seconds to show the users that they have depoisted...

In this situations like these the response times from my site to my bot are arround:

-check-itens.php: 10 seconds -deposit.php: 15 seconds -timer-end: 5 seconds

The request to the steam server take less than 5 seconds. Sometimes less than 1 second.

If i ping my site from the bot computer the response time is: 8ms... so i think the problem is to load my pages...

This makes those people that like to snipe the pots at the last few seconds super angry, because their deposits only goes to the next round.

Im running my site at a VPS:

Shouldnt this be enough? What specs should be ok to run this site?

linkzy commented 8 years ago

I may have found my problem. Looking at the apache logs and it seams that "update.php" is using all my cpu.

I lowered the update frequency in my "Script.js" and checked the response times... but i had only 8 users online at the time... every request returned the data in 3 seconds... still not the best performance, but way better than 15 seconds.

Since i cant upgrade my vps right now, i will try to improve my "update.php" to use less cpu.

Does anyone have any suggestions?

mx0c commented 8 years ago

maybe split script.js in different sections and call them seperatly.

linkzy commented 8 years ago

Thanks @mx0c . I like your idea.

The site is using the history table to handle part of the "current pot" logic... This leads to 4 querys every time Update.php is requested.

Splitting script.js and update.php will help. But what i really want to do is to avoid so many querys.

Maybe im doing something wrong, but thats what i discovered by monitoring my site today:

8 Users online: 100% Avarege MySql CPU Usage Arround 600 querys per minute

4 Users online: 80% to 90% Avarege MySql CPU Usage Arround 300 querys per minute

Or maybe this numbers are ok... and the performance of the site is a cost i have to handle some how.

mx0c commented 8 years ago

600 querys per minute is totally normal... i feel like your hoster is completely trash :X

mimiatmam commented 8 years ago

what hosting are you using to host this on ? IRL mysql usage should not go 90% for like 4 users .

mx0c commented 8 years ago

im using Blazingfast.io but i wouldnt recommend it...

mx0c commented 8 years ago

if you want you can test performance of my site^^ csgojack.de