Re: how to cache django javascript message file ('/jsi18n/') with apache (production setup)
This is a wrapper function and some instructions for enabling caching of the /jsi18n/ javascript string catalog: http://wtanaka.com/django/jsi18ncache --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: idea on how to cache django javascript message file ('/jsi18n/') with apache (production setup)
On Tue, 2009-02-17 at 03:55 -0800, alan wrote: > Following up on this discussion: > http://groups.google.com/group/django-users/browse_thread/thread/83f7b9b93973671f/e4b40ec5a482d155?hl=fr&lnk=gst&q=jsi18n+cache#e4b40ec5a482d155 > > How about a solution where the js i18n file would contain all the > translations for all the languages (in a dictionary indexed by > language)? That could be a potentially huge file. You'll only be using 2% of it, even with the current number of translations. Lots of unnecessary information sent over the wire there. > This way, the file could be cached by the browser (because non > language cookie dependent). > Of course it would require more bandwidth to transfert but: > - it would be transfered only once per client You're sending literally 50x more data per page than you would at the moment. We already send a bit more information than we have to, since we send all translations, rather than just those needed for a particular page (that's kind of hard to solve). It's survivable because web pages are reasonably regular (and repetitive), but a bit fragile. It also has to be checked for updates on the same frequency as the page data itself (and will change anytime the page changes). You'll get some reuse, but I'd want to see some more concrete numbers on potentially real-world-style data to be convinced about this. Hand-waving doesn't work here. You have to make some real measurements and carefully control for all the variables. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
idea on how to cache django javascript message file ('/jsi18n/') with apache (production setup)
Following up on this discussion: http://groups.google.com/group/django-users/browse_thread/thread/83f7b9b93973671f/e4b40ec5a482d155?hl=fr&lnk=gst&q=jsi18n+cache#e4b40ec5a482d155 How about a solution where the js i18n file would contain all the translations for all the languages (in a dictionary indexed by language)? This way, the file could be cached by the browser (because non language cookie dependent). Of course it would require more bandwidth to transfert but: - it would be transfered only once per client - gzip compression is very effective with this find of text files --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to cache django javascript message file ('/jsi18n/') with apache (production setup)
Thanks for the precise reply ... looking forward to know about your ideas on this matter ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to cache django javascript message file ('/jsi18n/') with apache (production setup)
On Wed, 2008-03-05 at 14:33 -0800, jfine wrote: > On Mar 5, 5:58 pm, "alain D." <[EMAIL PROTECTED]> wrote: > > Hi, > > > >If there a simple apache configuration that is know to make browser > > cache the javascript message file ('jsi18n') in a standard apache > > django production setup ? > > [snip] > > > To my django virtual host and then I get this headers in the reply : > > HTTP/1.1 200 OK > > Date: Wed, 05 Mar 2008 17:54:25 GMT > > Server: Apache > > Vary: Accept-Language,Cookie,Accept-Encoding > > Thank you for sending clear and precise information. I think the > problem lies with the Vary: header. Are you sure you want to tell the > cache that the javascript depends on the cookie? It has to depend on the localisation cookie. The jsi18n URL is mapped to the django.views.i18n.javascript_catalog view. This produces a file containing the translation strings for the requester's currently active language. Since the currently active language can be stored in the language cookie, the cache for that URL must depend vary on "cookie". This is fairly tricky to work around, since web pages need a single URL they can refer to in order to pull in the translation file, regardless of the user's active language choice for that particular request. Short version: it's pretty much impossible to cache that file directly. I have a couple of ideas to try and experiment with in the future, but it's not the highest priority item at the moment. Regards, Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to cache django javascript message file ('/jsi18n/') with apache (production setup)
On Mar 5, 5:58 pm, "alain D." <[EMAIL PROTECTED]> wrote: > Hi, > >If there a simple apache configuration that is know to make browser > cache the javascript message file ('jsi18n') in a standard apache > django production setup ? [snip] > To my django virtual host and then I get this headers in the reply : > HTTP/1.1 200 OK > Date: Wed, 05 Mar 2008 17:54:25 GMT > Server: Apache > Vary: Accept-Language,Cookie,Accept-Encoding Thank you for sending clear and precise information. I think the problem lies with the Vary: header. Are you sure you want to tell the cache that the javascript depends on the cookie? Hope this help. -- Jonathan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to cache django javascript message file ('/jsi18n/') with apache (production setup)
Hi, If there a simple apache configuration that is know to make browser cache the javascript message file ('jsi18n') in a standard apache django production setup ? I've tried to add : ExpiresActive on ExpiresDefault "access plus 1 month" To my django virtual host and then I get this headers in the reply : HTTP/1.1 200 OK Date: Wed, 05 Mar 2008 17:54:25 GMT Server: Apache Vary: Accept-Language,Cookie,Accept-Encoding Content-Type: text/javascript Content-Language: en-us Cache-Control: max-age=2592000 Expires: Fri, 04 Apr 2008 17:54:25 GMT Connection: close But my browser (firefox) keeps requesting this file for every (html) request that includes it ... Any idea ? Help ? Regards, Alan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---