Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:41:25+00:00 2026-05-25T06:41:25+00:00

I have two servers behind a load balancer. Each server is running a memcached

  • 0

I have two servers behind a load balancer. Each server is running a memcached server and the settings file (which is identical on both servers) has them both defined (in short: shared cache).

I want the paths to the generated files to be identical on the servers so that the client does not have to download more than once.

For me to get this working I need to understand how django compressor works.

  • What is the actual purpose of the cache in django compressor?
  • Is the file content stored in both cache and on filesystem?
    • If so, which happens first?
  • I hope I’m asking the right questions here. Feel free to add some.

A more detailed and better constructed sequence than this would be very helpful.

Edit

  • Since the servers both share a memcached server, should I set COMPRESS_CACHE_KEY_FUNCTION = 'compressor.cache.socket_cachekey' (see develop branch) or does using the same cache key contribute to my point of having the same file names?
  • The way I understand this, mtime is collected from the source js/css files to determine if they may have changed and a new file should be generated out of them. Correct?
    • This probably does not happen on each and every load. When does it happen?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:41:25+00:00Added an answer on May 25, 2026 at 6:41 am

    If you want to have identical cache files you must be sure that you have identical input on both servers.

    You should check:

    • if code in {% compress %}...{% endcompress %} is identical on both servers (if you deploying to both servers at once it should be)
    • if all your .css/.js files are identical on both servers (if you deploying to both servers at once it should be)
    • if mtime (modify time) of your .css/.js files is identical on both servers (your deployment script may affect those and set current date)

    If all of this requirements ale satisfied, generated files should be identical (content and names).

    You can check mtime using “stat” unix command.

    Answers to your questions:

    • Purpose of the cache in django-compressor is to reduce reads from file system.
    • Generated file with combined code is stored only on filesystem.

    Edit:

    I have checked it on one of my websites behind load balancer. I have different file names for .css files, but they are identical for .js.

    For .css files I use preprocessor (http://lesscss.org/), so it affects mtime.

    Edit (after topic developed):

    What is in the cache?

    Due to documentation django-compressor stores in the cache two different things:

    • mtime of cached files (rechecked every COMPRESS_MTIME_DELAY seconds)
    • full generated code ie.:

      <link rel=”stylesheet” href=”http://cdn.inprl.pl/CACHE/css/117f97d818b8.css” type=”text/css”>

    Due to following cache usage django-compressor reduces number of reads to filesystem to 0. This is essential for page speed, because reading from memory is hundreds times faster than reading from filesystem. Also filesystem is very often bottleneck.

    How it is stored in the cache?

    django-compress is storing code in the cache using generated key. Key is generated from:

    • code in {% compress %}...{% endcompress %}
    • mtime of files mentioned in {% compress %}...{% endcompress %}

    So those must be the same on all servers if you want to have consistent responses.

    PS.

    Please check constrains (like mtime) on your server and post here information if they match.

    I will be fixing the same problem on my site probably next week, I will post additional details then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an asp.net website hosted on two web servers that sit behind
I have two issues both related to (I believe) my SQL Server setup. I
We have two servers, a development/test server (Win Server 2008) and a live server
I have two dedicated servers and no hardware firewall. I'd like to forward all
When I have two mysql servers that have different jobs (holding different databases) but
I have a simple scenario, where two servers are connected through a gigabit link.
I have set up transactional replication between two SQL Servers on different ends of
I have to deploy my ASP.NET application into two seperated IIS servers. My application
I have two SQL Server 2005 databases, one is for development and the other
I have two web applications in the same server like this: /basedir/app1path/default1.aspx /basedir/app2path/default2.aspx How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.