Thanks for feedback.<p>&gt;  You would probably handle more requests if you changed that -- I would do the file access in a run_in_executor with a max executor workers of 1000.<p>This is really good point. I&#x27;m going to check this and edit post adding this information there.<p>&gt; Also, the placement of your semaphore acquisition doesn&#x27;t make any sense to me. I would create a dedicated coroutine like this:<p>looking into my semaphore code next day after writing it I do wonder if I&#x27;m using it correctly. I assumed it works correctly because it fixed my &quot;too many open files&quot; exception, so it seems to mean that I&#x27;m no longer exceeding 1024 open files limits. Can you clarify why you think my use of semaphore does not make sense and why your suggestion is better? What is the benefit of dedicated coroutine?<p>&gt; That being said, it also doesn&#x27;t make any sense to me to have the semaphore in the client code, since the error is in the server code.<p>I admit that I focused more on my client than server. One thing that worries me about my test server is that it does not print any exceptions. Either it does not fail at all, which seems unlikely, or it fails silently, which is more likely and is bad. So I need to check my server code to see what exactly happens there.<p>&gt; it also doesn&#x27;t make any sense to me to have the semaphore in the client code, since the error is in the server code.<p>main reason for semaphore in client code is that it should stop client from making over 1k connections at a time. My logic here is that if client wont make 1k connections at a time - server wont receive 1k connections at a time and thus there will be no problem of too many open files on server (it won&#x27;t have to send more than 1k responses). However I see that this logic may not be totally correct, other comment points out that it&#x27;s possible for sockets to &quot;hang around&quot; after closing: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11557672" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11557672</a> so I need to review that and edit post.<p>&gt; <a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;asyncio-dev.html#debug-mode-of-asyncio" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;asyncio-dev.html#debug-mod...</a><p>this looks really great, will look into this thanks.