# How are synchronous views handled by Django's ASGI application?

**URL:** <https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660>\
**Category:** Using Django\
**Created:** [September 10, 2021, 7:34pm UTC](https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660 "2021-09-10T19:34:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradydean](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bradydean/32/5788_2.png) [@bradydean](https://forum.djangoproject.com/u/bradydean)\
**Post date:** [September 10, 2021, 7:34pm UTC](https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660/1 "2021-09-10T19:34:59Z")

</div>

My team is having a discussion around using WSGI vs ASGI servers. One thing we do not know yet is how synchronous django views are handled by an ASGI server. We understand that async views will be executed in the event loop, but how are synchronous views handled by the ASGI application object? Are they also executed on the event loop or is there a separate thread to handle these views?

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [September 10, 2021, 8:00pm UTC](https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660/2 "2021-09-10T20:00:52Z")

</div>

Sync views, and middleware, will be executed in a sync thread pool.

This is somewhat documented here: [Asynchronous support | Django documentation | Django](https://docs.djangoproject.com/en/3.2/topics/async/#performance)

Django handles the bridging back and forth between styles for you with the asgiref [async adapter functions](https://docs.djangoproject.com/en/3.2/topics/async/#async-adapter-functions)

---

<div class="post-metadata">

**Author:** ![bradydean](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bradydean/32/5788_2.png) [@bradydean](https://forum.djangoproject.com/u/bradydean)\
**Post date:** [September 10, 2021, 8:17pm UTC](https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660/3 "2021-09-10T20:17:25Z")

</div>

Thanks for the quick response. Is there any documentation on how this thread pool works? For example, if sync views are placed 1:1 onto threads?

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [September 11, 2021, 11:23am UTC](https://forum.djangoproject.com/t/how-are-synchronous-views-handled-by-djangos-asgi-application/9660/4 "2021-09-11T11:23:17Z")

</div>

The only documentation is what I’ve pointed you at. You can otherwise see the asgiref source - it’s not too big.
