On 07 Feb 2008 Thu 13:20:47 pgb wrote:
> Eren,
>
> I don't have big experience but I think
> there is no way that you can use frameworks and have small amount of
> memory and slow processor, especially if your application is big.
>
> One of my colleagues spend about 4 months writing quite big project in
> django.
> It was installed on a small box with 512 MB of RAM and Celeron 2.0 and
> we asked 40 people to just browse the new intranet website - after few
> seconds the server went down.
> So we have moved everything to HP Proliant - RAID5, 4GB of RAM, 2x
> dual core 3.00GHz and MySQL db also to new machie with the same spec
> as web server.
> Unfortunately, even on new machine our server was not able to do more
> then 5 requests per sec without caching!
> What really surprises me is that big django app can use even 90% of
> CPUs!

Really thanks for your reply,

That's what I saw, in few minutes, my server was down :)

> My advice is to us ab (Apache HTTP server benchmarking tool) to see
> how many requests per second your site can do.
> but the first thing is to buy your servers more RAM and use cache.

I'll use this tool to see how strange my server is. It looks really usefull

> Just to see how fast caching can be, add the following into your
> settings.py:
> CACHE_BACKEND = 'locmem:///'
> and   'django.middleware.cache.CacheMiddleware' as a first line to
> your MIDDLEWARE_CLASSES

I have an experience in caching (at least, in how to setting up). I'll just 
set up a memcached server and install python bindings. I think, caching will 
reduce resource usage because most of the parts of the site is stored DB and 
is static. My site contains a lot of documents.

> Second thing is to profile your code.
> Django by default comes with django.core.handlers.profiler-hotshot
>
> To see where is the bottle neck of you app
> mkdir /var/log/cmsprofile
> chown www:www /var/log/cmsprofile
> add django.core.handlers.profiler-hotshot
> #PythonHandler django.core.handlers.modpython
> PythonHandler django.core.handlers.profiler-hotshot
> How to read the prof files from hotshot see
> http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/
>
> You can also use Profiling Middlware from
> http://www.djangosnippets.org/snippets/186/
>
> Processing requests can be very expensive.
> so users_list = get_users(request)
> where get_users is large def, will almost always take huge amount of
> resources.

Thanks. I didn't know this profiling stuff. I hope, I'll find out what parts 
of code are slow.

> Also, especially if your app is big, lines like:
>     houses = House.objects.all()
>     groups = Group.objects.all()
> is more then likely about 15 req per sec less, even if these are very
> small tables.
>
> kind regards,
> Paul

Best regards,
Eren

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to