On 08/02/2018 07:02 AM, Daniel Anechitoaie wrote:
I'm looking at frameworks likeĀ https://vibora.io/ that make use of
Cython to greatly improve the performance and I'm just wondering if
something like this would work with Django?
Was there any discussion (taken into consideration) about using Cython
to boost the performance of certain aspects of the framework?
Would it help make it faster?
I really love Python and Django for me is the best web framework out
there, but you have to notice how fast other frameworks from other
programming languages are.
Would using Cython help boost the performance?
There was a discussion some time ago about perhaps cythonising some of
the template engine and other select parts of Django. Someone did some
eexcellent independant work on this, and you should be able to find
their results in the mailing list archives.
However, I think you'll find the common wisdom on speeding up Django is
to reach for tools like PyPy, which can provide hot-spot JIT
compilation, thus focusing performance work on the parts where your app
needs it.
Further to that, my own experiences of optimising and scaling django
have shown often the performance bottlenecks are not where you expect.
As anyone in the industry will tell you, beware of benchmarks not
testing what you _actually_ do.
One time we got a dramatic improvement in site resource usage by moving
a user setting (like preferred language] into a cookie instead of the
user session. This allowed many requests to never access the session
store at all, avoiding a round-trip.
Another time, a site trebled in throughput (on average) by simply
upgrading Django. As is often the case, a smarter algorithm (in this
case, in how QuerySets made copies) will yield improvements orders of
magnitude more than minor optimisations.
As has been mentioned in other posts, async IO is often viewed as a
solution to performance problems. This is a furphy; asyncio can help
improve resource utilisation when you have an IO-bound workload.
It can allow fewer processes to scale more readily to consume more CPU
by avoiding blocking on IO. It's trues that the majority of web sites
are IO bound [waiting for DB, disk, or even other web sites].
However, this doesn't necessarily make each individual request any
faster - in many cases, it can actually be slower.
As is always the case with improving performance, measurement and
careful analysis are requried.
--
Curtis
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/d1fbf79c-6861-0ac4-d48e-f0316d0f3ca6%40tinbrain.net.
For more options, visit https://groups.google.com/d/optout.