How much ram django




















Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? Featured on Meta.

Now live: A fully responsive profile. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings.

Django memory usage is usually quote good, but sometimes — if you use the Django ORM without really knowing what is doing behind the scenes — you can see a huge spike in RAM usage. Fortunately there exist some simple methods to optimize Django memory usage. An experienced Django developer should immediately see the problem, but it can be interesting to analyze the problem a little bit more. After reading this good article I choose to use objgraph. The only drawback is that objgraph is designed to work in a python console, while my code is running in a Django powered website.

So I put together some code to redirect the standard output used by objgraph to my beloved Django logging system, and here is the result. In the Django log I saw something like this I cut from the log some internal objects not so interesting in this example :.

That means that every row three different objects are loaded in memory. But why Django is putting all those objects in memory? After all I want only to write a record in my dumb. It turns out that Django caches the results of each queryset, when you iterate over it.

Each and every object in the queryset will be saved in memory. This lets the ORM to access the queryset again very efficiently, without the need to hit the database again. Immediately create a swap partition, atleast of 2GB or more, as in any case of the server goes out of RAM, then SWAP will be used as memory usage, which will slow down server but atleast wont crash it.

To know the actual amount of usage, based on the number of users you are having, you need to use come load testing tools, which will test your website with 1, 10,20,50, users, and based on what type of requests you give to each user. For example, based on that software, you can record a user loggin in to site , surfing some pages and loggin off, and the software will run the same scenario for number of users you provide.

So for each number of users, you can check the amount of RAM used, which will give you an idea that how much RAM your site needs. Some of the load testing tools are :.

Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Ask Question. Asked 9 years ago. Active 9 years ago. Viewed 3k times. This is what I found: Starting a Ubuntu Thanks a lot. Improve this question. Robert Smith Robert Smith 1 1 silver badge 4 4 bronze badges.

How long is a piece of string? If you want more information, please ask!



0コメント

  • 1000 / 1000