background preloader

Optimización

Facebook Twitter

Busco a alguien para ayuda ^^ Django performance tips. Django handles lots of traffic with ease; Django sites have survived slashdottings, farkings, and more. Here are some notes on how we tweak our servers to get that type of high performance. Use a separate database server If you can afford it, stick your database server on a separate machine, too. All too often Apache and PostgreSQL (or MySQL or whatever) compete for system resources in a bad way. Use PostgreSQL I’ll probably get lots of push-back from the MySQL community about this one, but in my experience PostgreSQL is much faster than MySQL in nearly every case.

There’s no such thing as too much RAM Even really expensive RAM costs only about $200 per gigabyte. Faster processors really won’t improve performance all that much; most web servers spend up to 90% of their time waiting on IO! If you’ve got multiple servers, the first place to put your RAM is in the database server. Next max out the RAM on your web server. Turn off KeepAlive Use memcached Future directions. We.Developers 010 – Optimización Web | We.Developers. Continuando con la temática web del episodio 007, en este programa hacemos con Ramón (@m3drano) un completo análisis de todas las técnicas de optimización que podemos aplicar a una aplicación web, técnicas que podremos aplicar sea cual sea el framework o la plataforma que usemos en servidor, ya sea PHP, J2EE, .NET, Python o cualquier otra.

Para ello, atacamos el problema de la optimización desde las diversas fases: generación de contenido, transmisión y representación. Analizamos las características del protocolo HTTP, las estrategias de cache en cliente y servidor, las limitaciones de los navegadores y como superarlas, y las diferentes herramientas que podemos usar en cliente y servidor para medir, analizar y optimizar nuestra aplicación. Notas del Programa. Django performance tip: select_related() | Development Doodles. I was optimizing a Django application I’m working on the other day using Simon Willison’s excellent DebugFooter middleware, which adds a footer to each page showing which SQL queries were executed by Django when generating the page. I’m a bit of a caching addict so I had already added a caching layer on top of my models, and thus I was quite surprised to find that the most important page on the site still generated 5-15 SQL queries on every access, even though the objects it was accessing supposedly were cached.

The objects were indeed cached, but every time I was accessing one of the ForeignKey fields on the model objects Django generated a SQL query to find the data for the related object. This could quickly turn nasty if you follow such relationships in a loop on a high-traffic web site. The solution was the select_related() QuerySet method. Borrowing from the Django documentation, a normal ORM lookup would look like this: Like this: Like Loading...