Django site spawning/initial loading slow

Shared hosting plan.
I’m developing a couple of sites using django.
I’ve setup passenger_wsgi according to dreamhost’s help documents.
I’ve noticed that if the site doesn’t have any visitors for 30-45 minutes, then it would take 16 seconds to respond. This is day after day, at different times of the day.

I’ve tested this on a simple hello world page with no database and one h1 element.
I read that mod_wsgi has had this problem before, but we are using passenger_wsgi.

If I use google speed insight. Sites fast if I’ve visited it first.
But if I leave it be for a bit.
Google speed insight gives a timeout.

Am I missing something for passenger_wsgi.
Should I create a bot that hits my site every half hour so it doesn’t have to respawn.

This is something that shouldn’t be happening, even on a shared hosting plan. What’s the point of having a site if it takes a quarter minute to load a hello world. How will it be if it needs to query the database.

Is there something I can do to stop this from happening?

From this site:

Decreasing this value means that applications will have to be spawned more often. Since spawning is a relatively slow operation, some visitors may notice a small delay when they visit your web app. However, it will also free up resources used by applications more quickly.

My solution for the time being was to setup a cron job to make a request periodically. So far it’s working fine now. I’d like to find another solution sometime, but this makes me less hesitant to open some sites to the public.

If you haven’t already, you should check the load on your shared host (with the uptime command). Typically the load averages are in single-digits, so higher values may indicate that the server is having trouble.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.