django Architecture - Connection Management

django Architecture - Connection Management

Hussein Nasser

1 год назад

39,996 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ujjwal Bansal
Ujjwal Bansal - 10.06.2023 01:49

Awsome content.

Ответить
Orión González
Orión González - 19.05.2023 11:26

This is my Well actually comment:

you have two CPU threads per physical core.

Also it's the kernel who does the context switching, not the CPU

Also a thread that's waiting for network can safely be idle. As long as it's not doing work. The kernel is smart enough to give it a lower priority. Since read()ing a socket blocks (unless you're doing epoll) you can safely have 100 threads waiting for responses without a significant performance degradation. The problem will be of course if all of those threads are doing work at the same time, where you're absolutely correct.

Ответить
Riad Alimammedov
Riad Alimammedov - 04.04.2023 21:06

Hello Hussein,please record fastApi Architecture analysis.

Ответить
1412 kaito
1412 kaito - 29.03.2023 11:48

So, if in Django there is like 1 client, 1 thread, 1 query, then how does it tackle several (10k like) clients?

Ответить
Pushkar Anand
Pushkar Anand - 07.02.2023 08:54

Hussein, Can we do data replication in django? I am very confused about it. Some says yes, some say it cant be

Ответить
Isuru Cumaranathunga
Isuru Cumaranathunga - 14.01.2023 16:56

Hussain I don't hv words to say, these stuff are absolutely important and these are the actual engineering stuff. I love this content and really appreciate your effort on these videos. There stuff are really important for everyone specially for fresh graduates like me. Again thank you so much. Watching and noting down your videos is my new hobby. Thanks again.

Ответить
Venkata Vineel Yalamarthy
Venkata Vineel Yalamarthy - 13.11.2022 03:19

Is this video added in Udemy course as well. ? On another note, I have a question, if Python is not concurrent (can't run multiple threads at the same time due to GIL), how does Django handle concurrent API requests? Does it use multiple processes.

Ответить
Aditya Joardar
Aditya Joardar - 12.11.2022 15:54

I think this is one of the major drawbacks of doing backend processing in django, because if we have to update databases continuously in a background thread, that means we can't use persistent connection as it will keep one of the connections in idle state always

Ответить
Holthuizen oemoet
Holthuizen oemoet - 05.11.2022 17:17

I would love to see a video on a good multi client per thread model

Ответить
Mustapha Khial
Mustapha Khial - 05.11.2022 01:34

Great stuff!
it think it worthes mentioning that ORM only lately started being async in a very recent version, which means the thread will keep the request waiting and any other calculation as-well!
we d love to see how to do parallel processing in python and especially Js and Python!

Ответить
Andres Gutierrez
Andres Gutierrez - 01.11.2022 06:14

What about asgi with one thread how the Django will handle the transactions?

Ответить
S-111 0
S-111 0 - 22.10.2022 23:15

Qns???
I'm downloading something in my laptop from mobile's network so very interesting thing is happening all the time while downloading. That is , whenever in every 2-3 sec there is spam of 1 sec in which the Mobile network speed goes to less than 0 kb .
Why is that happening?
And and there is no drop-down speed in laptop. It's normal

Ответить
yash
yash - 18.10.2022 12:00

Great video 📹 👍 👏

Ответить
noriking146
noriking146 - 16.10.2022 08:49

Is it possible to do spring boot architecture and how project reactor works ? love the storytelling here !

Ответить
Hugo Pavan
Hugo Pavan - 15.10.2022 23:27

Got confused. Isn't WSGI spinning a new forked subprocess every time a new request arrives? How does that relates with this one connection per thread?

Ответить
Malek Alhourani
Malek Alhourani - 15.10.2022 16:51

Hi Hussein, thanks for such content, it is really helpful and help me to evolve.
I feel like using your old way of explaining stuff (using a PowerPoint presentation) is much easier to follow and make the topic you are trying to explain much simpler, I hope you return back to use it again, Thanks.

Ответить
Charan K
Charan K - 15.10.2022 14:40

Hi Hussein, Thanks for sharing quality content.
Can we expect a course on LInux OS fundamentals on udemy as u created for networking ? Please reply. Thanks

Ответить
RIZWAN FIRDOUS
RIZWAN FIRDOUS - 14.10.2022 23:30

I highly appreciate your video and the hardwork behind it. One request to you could you please make a same kind of video for hibernate and tomcat. Please...

Ответить
Harsh
Harsh - 14.10.2022 19:09

Nice T shirt 😂

Ответить
huss97
huss97 - 14.10.2022 16:26

Great video from one Hussein to another

Ответить
Aashay Amballi
Aashay Amballi - 14.10.2022 13:56

Django is ❤

Thank you Hussein for talking about Django and covering about this topic...

Ответить
Tobi DEGNON
Tobi DEGNON - 14.10.2022 13:41

I'm sot sure but the way you talk about threads here make me feel that you are actually talking about worker process, not threads, each process having it's own memory, I'm I missing something here?

Ответить
swapnil jena
swapnil jena - 14.10.2022 11:15

I'm going to post this here as well as on Stackoverflow. So here it goes:
I am running Django app using the WSGI server (gunicorn) on Linux. I am using the local memory for caching inside the application. I am using 3 workers (workers are altogether different forked processes that shared different memory spaces) and multi-threads using g-event under each worker. As the memory space is the same for each worker I'm safe having one single cache in one worker. But the load to the workers is balanced by the OS kernel so if the workers have different memory space so, the application cache 'set' by one worker can be made a 'get' by another worker or will it turn into an issue. I can solve this using unified caching using Redis or Memcached but wanted to clear this doubt before implementing another new service.

Ответить
Atul Kumar
Atul Kumar - 14.10.2022 07:52

As always, great video. Thanks you so much, learned few new things!

Ответить
SUPER MAX
SUPER MAX - 14.10.2022 05:57

So is it not good to use multiple threads? Even though there is context switching wouldn’t still go much faster than blocking I/o? Isn’t that why it exists? GIL or not?

Ответить
John from tennessee
John from tennessee - 14.10.2022 02:58

Could you do a similar video but for Rails? Would be hella interesting to compare.

Ответить
Mohd Imran
Mohd Imran - 14.10.2022 00:16

Thank you Hussain.. I am waiting for your 5th udemy course 😅

Ответить
Alex Smart
Alex Smart - 13.10.2022 23:18

Hi Hussein, I don't quite agree with your discussion regarding context-switching near the end of the video. Your typical web-server is IO bound and like you explained the worker threads are just mostly sitting idly waiting for a response from the database. If that is the case, why would context-switching be a significant concern? Even if you have a hundred threads, the context switch only happens when there is an actual response from the db server, right? And when it does happen, the cost of the context switch (< 10 μs) is insignificant compared to typical db response times (at least a few milliseconds).

Ответить
S B
S B - 13.10.2022 21:22

django have sqlite3 api?

Ответить
Sachin Dolta
Sachin Dolta - 13.10.2022 19:00

Much love

Ответить
Ramang
Ramang - 13.10.2022 17:35

fast api next?!

Ответить
Hiddenberg
Hiddenberg - 13.10.2022 15:26

Hussein could you please explain how WSGI servers work or why are they necessary for production with the python frameworks and not with other languages like node js or go?

I just can't understand why they need that intermediate layer between the python server and the clients

Ответить
Matrix Too Good
Matrix Too Good - 13.10.2022 15:15

Thank you for this amazing video! I would love to see a video on frontend listening models.

Ответить
fr0zeneye100
fr0zeneye100 - 13.10.2022 14:40

Lol. Love way you say the bad kid dB. Really the orm. I am beginner Dev level but crap. I am forcing myself to do ORM way coz want to learn but just SQL seems so much easier than rubbing ORM into compliance. Really ORM is the hardest and doing Django way. But at times the SQL is way quicker than orm... But yeah learning is cool and your vids even better.

Ответить
mehdi
mehdi - 13.10.2022 14:00

what about async orm (django4+)?

Ответить
AmirH Mahmoodi
AmirH Mahmoodi - 13.10.2022 12:42

Hussein, what does happen if you put PgBouncer into this?

Ответить
Kawsar
Kawsar - 13.10.2022 12:32

Thank you 🥺❤️

Ответить
Abiira Nathan
Abiira Nathan - 13.10.2022 09:29

I believe the problem is not with Django per say but python's threading model. Yes you guessed right, the GIL. Also to avoid data races, Django has to execute the queries synchronously. Even using async frameworks like django channel, you must wrap your async coroutines with synchronous helpers. Hello GIL

Ответить
Andreas Malis
Andreas Malis - 13.10.2022 08:31

Thank you sir!! Awesome video!!

Ответить
Samy Driss
Samy Driss - 13.10.2022 08:28

Hussein, I love and appreciate all the content you put out. You truly are a rare breed of teacher.

I can't express my gratitude enough as well as how much you have taught and have helped me throughout my career. I always learn something new when I watch your videos, take your courses, listen to your podcasts or read your articles.

You have this great ability to go very deep into the technology stack without confusing people. Really, not all heroes wear capes.

Also, are we seeing a teaser for a Udemy course here? 👀

Salam from 🇩🇿

Ответить
Dipjul Rahman
Dipjul Rahman - 13.10.2022 08:17

Very interesting! Can you please make a video on spring/springboot backend architecture?

Ответить
Ssali Jonathan
Ssali Jonathan - 13.10.2022 08:04

Thanks for making this video Hussein.

Ответить
GodHatesFags
GodHatesFags - 13.10.2022 07:59

Thanks for great explanation, was using this framework for a couple of years before, and was wondering about someone explain how it actually works behind the scenes) keep it up!

Ответить
Kerod Fresenbet Gebremedhin
Kerod Fresenbet Gebremedhin - 13.10.2022 07:56

never knew django was this stupid

Ответить
Daniel Tate
Daniel Tate - 13.10.2022 07:54

Very interesting, I would be interested to hear your opinions on Laravel a popular PHP framework.

Ответить
Dinesh
Dinesh - 13.10.2022 07:50

Greatly informative like every other video. What do you think about netty and its use cases??

Ответить
Build More
Build More - 13.10.2022 07:24

You remind me of Firas Zahabi.. related?

Ответить
Artur Corrêa Souza
Artur Corrêa Souza - 13.10.2022 07:13

Awesome video!

Ответить
Syed Azzam Zafar
Syed Azzam Zafar - 13.10.2022 07:12

I am beginner django developer. What course from you should I take first to improve my backend knowledge?

Ответить
umang malhotra
umang malhotra - 13.10.2022 07:11

Really informative video. Make more like these !! We love it.

Ответить