I've got a simple django page which has a counter onto it. I personally use Apache2 with mod_wsgi for everyone it.

First, after i enter this site, the counter shows , because it should. The 2nd time after i go into the page the counter shows 1 - again, it's the right behavior. The issue starts now, cause after i enter this site the 3rd time, I recieve again.

After I refresh it is going between , and 1, clearly with a couple cache approximately. Basically watch for a while after which repeat the process, it'll show 2, and three, and can be tied to individuals values, till this cache or anything is going to be flushed, and so the counter continues.

Does somebody knows the way i could possibly get it work right (the actual scenario handles getting data in the DB, however the issues with this strange cache are identical).

BTW, I haven't any caching engine occur my django configurations.

Quantity of instances != processes * threads as recommended by other poster. Quantity of instances == processes only.



Likely you're running embedded mode. You need to rather use daemon mode.

Don't set 'processes=1' though as that's the default anyway and taking advantage of the choice has other unwanted effects you might not want.

The default quantity of threads for daemon mode is 15 that is fine as long as the application is thread safe. Particularly, use of your global counter ought to be thread safe.

Also read:


that has a good example of how to setup daemon mode. You should utilize both WSGIDaemonProcess and WSGIProcessGroup directives, getting just WSGIDaemonProcess isn't enough.

You're running multiple cases of your Django. Apache connects at random to one of these.

For testing reasons, do this inside your apache.conf:

WSGIDaemonProcess mysite processes=1 maximum-requests=500 threads=1

(You might want more processes being produced use.)

See full documentation of options.