Few months ago i asked this about the implementation of my api for processing files it uses PHP, a command line script that is called via PHP and queue. For the queue i am using beanstalkd
The API accepts one file or group of files (up to 5) per request. Processing one file takes 1-3 seconds depending of the size.
My question now is whatever will be better, to put every file of the request to a separate job or all the files in one job? My function for processing that is slow accepts one or multiple files. My guess is that i put the all the files of the request on processing, they will be processed by one worker. But if i put every file into separate background job it will be probably processed by own worker so 4 files 4 workers - that is what i think. Not sure if this is correct.
So if my above conclusion is correct, is it better for a lot of requests to process all files in once or add them separate worker?
Thank you.