# The Trouble With Middleware

**URL:** <https://forum.djangoproject.com/t/the-trouble-with-middleware/19>\
**Category:** Async\
**Created:** [September 9, 2019, 1:35am UTC](https://forum.djangoproject.com/t/the-trouble-with-middleware/19 "2019-09-09T01:35:49Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![andrewgodwin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/andrewgodwin/32/2_2.png) [@andrewgodwin](https://forum.djangoproject.com/u/andrewgodwin)\
**Post date:** [July 13, 2020, 11:07pm UTC](https://forum.djangoproject.com/t/the-trouble-with-middleware/19/16 "2020-07-13T23:07:52Z")

</div>

The Django middlewares have been made async-compatible so they only use a thread on the way in and out, rather than keeping it open the entire request, but they’re not fully async.

Full-async mode allows as many requests per thread as your CPU can handle, but it’s still the case that if you bring a sync middleware in that’s totally incompatible that it takes one request per thread  
(Python forces that on us). With the async-aware middleware that’s still running things in threads for handling requests/responses, though, I think it should be able to fit quite a few requests per thread, but I’d need to go check.

---

_[View the full topic](https://forum.djangoproject.com/t/the-trouble-with-middleware/19)._
