Jump to content

Putting users in queue


johnrb87

Recommended Posts

Hi all

 

I am having a nightmare coming up with something and I wonder if I could pick everyones brain.

 

I am helping to setup a mini web system for a friends dads work, the server is held internally on a very old machine, the current system runs ok and I am just helping to add some new things in.

 

One of the functions they have is a "job" tool, which allows people to submit a small form of data about the job they are currently doing, this is used by internal and external staff.

 

There network is really old and slow as well as the server the scripts are on, and they have no money at the moment to upgrade it, one of the reasons for these enhancements is so they can free up some money, so i'm doing my best to help them.

 

The problem I am having is that when more than 150 users are submitting the form at the same time, the PHP pages are just timing out and the user has to go back to stage 1, their peak has been 230 users, which caused everyone a problem.

 

So I wonder, is there anyway to create a queue style system with a countdown timer? So for example, when the user logs in, if there are more than 60 active users currently submitting on that form, then it would place that user in a queue for X number of seconds\minutes, then when one of those 60 users finish with the form or their 10 minutes is up, the user logged in is then forwarded to the form allowing them to complete it.

 

I was going to give each user a maximum of 10 mins to complete the form before they are chucked out the queue, if that's possible.

 

I was thinking about maybe logging them into a new bigger server online, then when number of user sessions drops below 60 on the current internal server, then they are forward to it, which allows them to complete the form, so you only ever have 60 users on the internal server at once. But I have 0 clue where to start.

 

Is this a totally custom hard job? Or is there something anyone can point me to?

 

Thanks very much all

 

Johnny boy

Link to comment
Share on other sites

You mentioned the form data is submitted, where to? You may be able to simply improve the efficiency of the code to get around this problem, rather than thinking up hacky solutions. Even just upgrading the PHP/MySQL(?) version on the server, and redoing some of the vital code could help to improve things.

Link to comment
Share on other sites

It's submitted to the internal server, when you login from an external location, you're really accessing the internal server.

 

I know I could improve things, but they are 100% set on this queue system as they are wanting to take on more external people which could boost numbers up even more, I think even with the best code, the server will struggle.

Link to comment
Share on other sites

OK, I will suggest a combination of what MrAdam suggested AND a queue system. Without doing some testing I can't be sure, but I suspect the problem is not with the submission of the data, but in the processing of the data. At the very least you should add some debugging code to the processing page to determine how long the page is taking to process. You could even add code to capture teh execution time at specific points in the processing to determine where the slow down is occuring.

 

At the very least you will determine if the problem is with the processing of the data and where, specifically, it is occuring. Then, assuming the problem is with the processing you can do a couple of things.

 

One, you might be able to identify some easy fixes to improve the processing. E.g. are there any database queries being run in a loop? That will be a huge resource hog. If you can't determine any fixes, just post the relevant code here and I'm sure we can help.

 

Second, if you can't determine a fix for any slow processing then you can implement a queue system for the processing of the data. I would allow people to go ahead and submit their data as they please. But, instead of immmediately processing the data, just add the raw data to a temporary table. Then have a scheduled script that actually processes the data as needed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.