One more thing -

All the third party resources i.e. js and css files e.g. bootstrap, jquery,
etc;  don't fetch them from your server.
Use CDN for those. This will help the load times a lot.


Regards,
Chetan Ganji
+91-900-483-4183
[email protected]
http://ryucoder.in


On Fri, May 3, 2019 at 2:47 PM Chetan Ganji <[email protected]> wrote:

> Hi Saurabh,
>
> You are welcome :)
>
> No 1 will give you insights about which endpoints are taking the most time
> to load. Then, you can drill down the specific endpoints for bottlenecks.
>
> Two more things you could try.
>
> 1. Remove unused/unnecessary middlewares from the middlewares list in the
> settings.py of the project.
> As they are executed before and after every single request, they could add
> hugh unnecessary overhead easily.
>
> 2. Normally requests are processed in synchronous manner. Gunicorn has
> aysnc worker types.
> I did not have a need to look into it yet, but they could help speed up
> things.
> I would not suggest it for payment gateway endpoints. If your project is a
> ERP/CRM type project, it could help you a little to look into it.
> https://www.spirulasystems.com/blog/2015/01/20/gunicorn-worker-types/
>
> Nginx already handles requests async manner. Try combining Nginx + Async
> worker in gunicorn.
> You could get some boost.
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> [email protected]
> http://ryucoder.in
>
>
> On Fri, May 3, 2019 at 11:00 AM Saurabh Adhikary <
> [email protected]> wrote:
>
>> Hi Chetan,
>>
>> 1)  Yes . We are infact trying this. Thank You.
>> 2) *Taken*
>> 3) We are on MySql , migration will cost a lot of man hours, which can be
>> invested only if the result is concrete.
>> 4) Up-gradation, that's our last resort.
>> 5) Tried almost all. All in vain.
>>
>> Thanks for your inputs. :)
>>
>> On Thursday, 2 May 2019 17:52:11 UTC+5:30, Chetan Ganji wrote:
>>>
>>> Not sure about whats the issue. You could do couple of things to
>>> understand whats the root cause of the problem.
>>> I know they are generic guidelines. Anyone couldnt be more specific than
>>> this.
>>>
>>>
>>>    1. Benchmark the time required to process each request. You could
>>>    write a middleware to track this time.
>>>    Attach starttime to each request object and read that at the time of
>>>    returning the response.
>>>
>>>    2. Try using the django debug toolbar to see how much time it is
>>>    taking to execute the sql queries.
>>>    There might be some room for improvement as most developers dont
>>>    practice sql regularly.
>>>    https://django-debug-toolbar.readthedocs.io/en/latest/
>>>
>>>    3. Maybe try using a different database - PostgreSQL, MySQL, etc.
>>>
>>>    4. But if you have time for R&D, you could try using the different
>>>    python implementation, it is said to be faster in many cases than 
>>> cpython.
>>>    It's not 100% compliant i.e. some packages might not work with pypy.
>>>    So please do your research before walking down this road.
>>>    https://pypy.org/
>>>
>>>    5. Try using a different web server. If you are using Apache, try
>>>    using nginx. Also use a different wsgi server. If you are using gunicorn,
>>>    try with waitress or others.
>>>
>>>
>>>
>>> Regards,
>>> Chetan Ganji
>>> +91-900-483-4183
>>> [email protected]
>>> http://ryucoder.in
>>>
>>>
>>> On Thu, May 2, 2019 at 5:09 PM Saurabh Adhikary <[email protected]>
>>> wrote:
>>>
>>>> Hello ,
>>>>
>>>> I'm using Django version 1.8.1  and Python version 2.7.12 . Suddenly
>>>> since Feb '19 there has been a drastic decrease in my website's response
>>>> rate.
>>>> For sure , there has been some minor increase in the no of hits, but
>>>> the performance is too bad.
>>>>
>>>> Initially , the thought came that the hardware of the server was old ,
>>>> so a new server with high configuration was bought.
>>>> We have done the new indexing also on it.
>>>> Still the sought for a higher performance is awaited.
>>>>
>>>>
>>>> Is it that the Django support for 1.8.1 or Python support for 2.7.12
>>>> has reduced and that is casing the website to slow down or I am missing out
>>>> on something ?
>>>> Kindly help.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/238a6da2-8f34-4b8b-939c-e20d4306545b%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/238a6da2-8f34-4b8b-939c-e20d4306545b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/64e51c12-1ff3-4e9f-a45b-e0d32a6551b3%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/64e51c12-1ff3-4e9f-a45b-e0d32a6551b3%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKMUjsHZRHj-j10Bf_5DxapcHu1w2tYBt2vLSFEYpojBHTckA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to