Something resource heavy in your web app? Consider background-processing
Imagine you have a web app where a user can upload an image, video, raw data.. whatever.
Mostly you handle those files somehow. It may include image processing, video processing etc. Should your web app handle this? I would say no.
In my opinion a web app should only serve files, manage users, authorize them etc. All data processing should be outsourced to an other process.
Background processing helps you solve the lags between successful request and rendering response. Imagine Youtube. When you upload a video it tells you that your Video is being processed. Would you rather wait and watch 1-2 hours the loading image in your browser? I don't think so. They process your video in background.
This of course doesn't mean that you can only background-process files. You can background-process everything, database queries, some code, anything.
There are some libraries that help you achieve background processing. The most known are probably Resque, Delayed Job and Sidekiq.
So do you have some resource heavy processing? Make your web server lazy and outsource them to an other process.
Outsourcing file processing to a background job could help you maintain file security a bit more. As the one who is responsible for the file is not your webserver user but an other user who work with those files (Requires creating an other user account on your machine). This user in most cases will just run the background jobs and will be responsible for the files. So disallow running files for him and no script-kiddie should be able to upload a stinky self-running file to your file system.