> Hi,
>
> I am trying to get my head around hosting around 50 sites using pretty
> much
> the same codebase. The way I see it I have two approaches:
>
> 1. Have the common code in a library which is referenced across all the
> sites. My concern is that I may have to have 50 instances of UWSGI
> running,
> which would probably eat up my memory.
>
> 2. Have a single site which changes it's content based on the hostname,
> and
> runs on a single UWSGI instance like the django sites framework:
> https://docs.djangoproject.com/en/dev/ref/contrib/sites/
>
> On paper, option 2 seems best, because I only need a single UWSGI instance
> so my memory useage will be less, but I really don't like the system, the
> code will end up looking quite ugly.
>
> I just wondered if anyone else had encountered this sort of thing and
> could
> offer any input at all to help me on my way.
>
> Thank you.
>

Personally i tend to avoid mixing multiple applications in the same
process (unless there are advantages in it).

I suggest you to configure an Emperor with each vassal in "cheap" mode
(only the master will be spawned) and with idle enabled. A good combo for
avoiding memory allocation til needed:

[uwsgi]
master = true
cheap = true
; load application only in the workers
lazy-apps = true
; destroy workers after 60 seconds of inactivity
idle = 60

with this setup 50 inactive apps should not consume more than 100MB.

If you can enable KSM you can reduce those 100MB to (probably) 20-30

http://uwsgi-docs.readthedocs.org/en/latest/KSM.html

there are other approaches too, but this should be quite easy to implement


-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to