Can a server handle simultaneous shell commands?
Solution 1:
If you are doing it via PHP (or any other language that has access to shell commands) they will be done separately, which means that they will be done simultaneous if by chance the 10 users use the PHP script at the same time. Each PHP call through shell_exec
will be done independent of the others. I myself have a shell_exec
script which shows some information to my users for certain images and this is done independently from other PHP executed scripts through shell_exec
.
There is a limit to how many simultaneous users PHP can handle, but it depends on your web server, PHP configuration file and MySQL if you are using it. I know the number is greater than 100 at the same time.
When using CPU intensive commands, for example converting videos, the effective use of the commands would then depend on how much RAM you have and how much CPU power you have. For someone with 64 MB RAM and a 80486 it would go bad to try to convert two videos and 10 songs. That would overload the system. For someone with a Core 2 Duo server and 4 GB RAM I think converting several songs would be a piece of cake.
So basically, yes, Linux can handle multiple simultaneous shell commands, specially from PHP, but the overall performance would depend on the resources of the server (CPU, RAM, hard disk drive, etc.)
Solution 2:
If you were to support a large number of users you would have to investigate an alternative method of handling the conversion process.
For example you would likely setup a job scheduling system such that you post requests to the system to convert a file and poll the system for completion status. The scheduling system would take tasks from a queue and say perform up to four file conversions at a time.
This question might be of interest:
https://stackoverflow.com/q/265073/175849