Reputation: 18198
Alright, I have a JavaScript doing HTTP Requests to a PHP file onto the same directory. Then it's returning it's output.
Let's say there are over 50+ people doing this request simultaneously ... will it slow down anything? Yes, this may seem like a dumb question - but sorry. :|
Thank you.
Upvotes: 0
Views: 171
Reputation: 42109
Upvotes: 1
Reputation: 7183
Depends on several factors. Are you caching your pages? this would speed up page rendering. how fast is the actual riddle.php script, is the DB interaction that could get bogged down? what is the capacity/memory of the server you files are hosted on, what is the connection speed to that server? how much data are you rendering back? all these things figure into your answer. The best thing to do is actually write something to simulate your expected load and check your results.
Upvotes: 0
Reputation: 11069
Potentially yes. There are some basic questions to answer:
Note that the first answer may vary if riddle.php accesses any shared resources (files, database tables) that may require locking for updates.
Upvotes: 1
Reputation: 54884
It really depends on your backend code.
I have a php file for a scrabble type game, which simply checks if the word is valid. This does a database lookup, and responds with a true or false. It sounds like your request is doing something very similar. The way you are doing it is one of the most efficient ways, because you are only checking the results, rather than doing a full page reload.
The result is less than 20ms usually, and under load does not particularly increase that much. But my code is doing very little.
In principle though, what you are doing is fine.
Upvotes: 1
Reputation: 943563
Dealing with multiple requests at once will need server resources. It may or may not slow things down appreciably depending on how much load the server and network connection can handle.
Upvotes: 0