Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 June 18, 2010 18:23:00

T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

static files, nginx, memcached


This probably isnt the *best* place to post this, but I figured a lot
of folks here have had experience with this.

I am switching off lighty to nginx for static file serving as it
handles memcached (as far as i know, lighty does not). Anyhow, I have
it up and running ok, but im not sure what the best course of action
is for getting items into memcached.

My thoughts right now are for it to check memcached for the key, if
not found, then serve up the file from disk. Everything else goes to
apache. I will just have a cron job populate memcached separately.

Is this a common practice or is there a better method for this?

Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 18, 2010 18:56:39

Javier G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

static files, nginx, memcached


On Fri, Jun 18, 2010 at 12:22 PM, TheIvIaxx <theivi...@gmail.com> wrote:
> My thoughts right now are for it to check memcached for the key, if
> not found, then serve up the file from disk.  Everything else goes to
> apache.  I will just have a cron job populate memcached separately.
>
> Is this a common practice or is there a better method for this?

be sure to benchmark it. in many cases, nginx will serve from static
files just as fast as from memcached.

yeah sounds crazy, but if nginx give the OS some hints, it will cache
the files in RAM, a lot more efficiently than memcached (less context
switches, no TCP involved, can dynamically get hold and release RAM as
available, etc...)

--
Javier

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 18, 2010 23:52:36

T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

static files, nginx, memcached


Its a lot of little files and from what i've seen, the stat call is a
bottleneck. If they are all in memcache, then it should scream.

Which "hints" would you be referring?

On Jun 18, 10:56 am, Javier Guerra Giraldez <jav...@guerrag.com>
wrote:
> On Fri, Jun 18, 2010 at 12:22 PM, TheIvIaxx <theivi...@gmail.com> wrote:
> > My thoughts right now are for it to check memcached for the key, if
> > not found, then serve up the file from disk.  Everything else goes to
> > apache.  I will just have a cron job populate memcached separately.
>
> > Is this a common practice or is there a better method for this?
>
> be sure to benchmark it.  in many cases, nginx will serve from static
> files just as fast as from memcached.
>
> yeah sounds crazy, but if nginx give the OS some hints, it will cache
> the files in RAM, a lot more efficiently than memcached (less context
> switches, no TCP involved, can dynamically get hold and release RAM as
> available, etc...)
>
> --
> Javier

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 20, 2010 07:06:04

Javier G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

static files, nginx, memcached


On Fri, Jun 18, 2010 at 5:52 PM, TheIvIaxx <theivi...@gmail.com> wrote:
> Its a lot of little files and from what i've seen, the stat call is a
> bottleneck.  If they are all in memcache, then it should scream.


yes, this sounds like memcached territory. still, we can argue all
we want but a little benchmark would tell a lot more.


> Which "hints" would you be referring?

the extra parameters used when opening and reading files. there are
lots of small flags, each one with a different set of pros/cons on
different OSses. nginx is quite good at using the best for
performance in most cases

--
Javier

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 June 21, 2010 03:59:36

Gabriel G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

static files, nginx, memcached


On Fri, Jun 18, 2010 at 11:22 AM, TheIvIaxx <theivi...@gmail.com> wrote:
> I will just have a cron job populate memcached separately.
>
> Is this a common practice or is there a better method for this?

I think the overall approach might need a little more thought, but if
you end up doing something like this, incron would be a far better fit
than cron.

my 2 cents,
Gabe

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support