I am writing an application on the platform play 2.0. The purpose of this application is to process image downloads and resize them in the background.
Download is carried out through a standard mail handler, which saves the file in the file system. Right now, this is only done for an event or input / output stream. After the file is successfully saved, the AKKA actor is sent a message about resizing the original image to several different sizes (currently 4). These resize operations require a processor and take a little time.
All this works well, until I test the application under some load. Under load, resizing operations efficiently absorb all available processor time, and therefore incoming HTTP requests are a little hungry for processor time, and we see the lag behind these requests to such an extent that eventually the requests begin to count down.
So the question is, how do I configure the system (or rewrite it) to give incoming HTTP requests a higher priority than resize requests?
source
share