Jump to content

[Solved] Sql Max_User_Connections?


GroovyCarrot

Recommended Posts

Hey I have a phone service from some iPhone software I've developed and I realise there is a lot of users that use it, some 5000 users while many of them won't be making connections to the server at the same time I was just curious what the maximum amount is?

 

As I get a log of errors daily when apparently there is just a lot of connections occuring. I use PHP and have checked everything to make sure the connections are closed when they are done, and the majority of the time it is no problem.

 

Thanks in advance!

Link to comment
Share on other sites

It's interesting that you came here to ask this. Currently your account is the second highest load account on your server, and you are the highest memory usage account. What that means is when one of your users are active on your site your account causes the whole server load to spike up. When the load spikes up mysql, which is very sensitive to high load, slows down considerably. The slower mysql processes your queries the higher chance you have of seeing an error due to maximum connections.

 

The solution to all of this is to make changes to your site to reduce the load it causes. If you use less memory, and less cpu it will reduce the chances of your account being suspended. As a nice side effect you should also see mysql connection limit errors drop too. You're in the unique situation of being able to solve your own problems here.

 

The reason I say it's interesting that you came here to ask this is because the only reliable way we have of letting users know that they are causing problems on the server is to suspend their account. You've essentially saved yourself some potential downtime by coming here to ask this rather than waiting for your account to be suspended.

Link to comment
Share on other sites

Well I was going to message you but it seems you can't receive messages so here:

 

Ah well thank you for getting back to me quickly as I have apparently made a bad impression aha. I asked because I wanted to know what kind of numbers I was dealing with, I didn't realise it was actually really high!

 

I've made quick changes to the code to cut out unessential queries, to be honest the amount of users overwhelmed me a bit, mainly because due to piracy of the software there are a frequently increasing number of users that I can't keep track of - I added a system to identify individual devices and the number of identifiers issued is approaching 6000 while Cydia tells me I should only expect one tenth of that number.

 

As I said, I've removed unessential queries that are causing stress on the server and mysql, I haven't had any errors yet but most of the time it's okay anyway so please let me know if it is still an issue.

 

I was going to supply an email address to get to me quickly if it is still causing stress but you'll have to message me for it

 

Thanks again and sorry!

Link to comment
Share on other sites

It looks like your changes might have helped, or your coincidentally received a lot less traffic today, but either way your account is now 8th highest load and 2nd highest memory usage over the past 17 hours.

Link to comment
Share on other sites

Okay thanks, yesterday afternoon I changed the system so that rather than every time a user made a connection it opened a database connection, it passes timestamps between the device and the server and will only open a connection after an hour has passed since the last check, I've changed it to 3 hours after reading your post now; that should significantly reduce memory and sql queries, though the number of identifiers issued has passed 7000 so I realise there is rapidly more and more pressure being put on the server but we'll have to see how it goes and if necessary I'll hammer down on it harder.

 

I've also just gone through that link and made sure all assigned variables are unset at the end of use to clear them off the server, I'm hoping it should make a difference across the amount of users but tonight I will come back to it and try to find where the memory usage is highest and how much memory it's dealing with to try and optimise it even more

 

Thanks again for the help, you guys do a great job - I've never had such good hosting before and that you guys do it for free is fantastic.

Link to comment
Share on other sites

Like Krydos said earlier, yours is a unique case, usually our system would suspend an account using gobtons of resources and then most the time the user tries to blame our servers/us for their bad code's issues. It's nice seeing a user with enough sense to realize their code and the amount of users they have could cause a problem and work to minimize their account's resource usage before they reach that point.

 

At some point there might be a need for you to look at getting a paid VPS, but if you have 7000 unique users and a fair chunk of them paid for your software that really shouldn't be an issue. In the meantime we're glad to give you somewhere to host your software and work on the fine-tuning.

Link to comment
Share on other sites

Just yesterday I started looking for a good VPS, but I'll have to wait until I start getting some payouts from Cydia before I can start renting one so I appreciate you guys letting me work on your server for the mean time, while I work out whether it's worth the investment or I should just cut out the whole thing. But I'll try and move of your server quickly if it starts to become a persistent problem as I realise all the other users suffer as a consequence. I've had ideas to set up services that will require having a server so it might be worth while, to be honest everything I've done so far has been mainly just a bit of experimenting.

 

I've used try{} and catch{} to at least stop running the rest of the script if a database connection fails as I notice max_user_connections still accumulates at what I can only guess is a peak in usage, so I'll see how that fares.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...