No problem, it&#x27;s especially hard to find external feedback for side projects and experiments so I try to give it when I can.<p>&gt; I assumed it works correctly because it fixed my &quot;too many open files&quot; exception<p>It works, so at the end of the day that&#x27;s what matters. The client vs server question, from my perspective, ultimately comes down to a question of test realism; in a real-world deployment you couldn&#x27;t limit connections with client-side code because there are multiple clients. That&#x27;s what I mean by &quot;it doesn&#x27;t make sense given that the error is server-side&quot;.<p>&gt; 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>I&#x27;m saying that mostly, but not exclusively, from a division of concerns standpoint. You&#x27;re acquiring the semaphore in a completely different context than you&#x27;re releasing it. On the one hand, that&#x27;s partly a programming style issue. On the other hand, it can also have some really important consequences: for example, it&#x27;s actually the event loop itself that is releasing the semaphore for you when the task is done. Because of the way the event loop works, it&#x27;s hard to say exactly when the semaphore will be released. You want to hold it for the absolute minimum time possible, since it&#x27;s holding up execution of other connections in the loop. Putting it into a dedicated coroutine makes it clearer what&#x27;s going on, makes it such that the acquirer and releaser of the semaphore are the same, and means you are definitely holding the semaphore for the minimum amount of time possible (since, again, execution flow will not leave any particular coroutine until you yield&#x2F;await another). In general I would say that releasing the semaphore in a callback is significantly more fragile, and mildly to moderately less performant, than creating a dedicated coroutine to hold the semaphore and handle the request.<p>Does that all make sense?<p>&gt; Either it does not fail at all, which seems unlikely, or it fails silently, which is more likely and is bad.<p>That&#x27;s a fair statement, I think. As an aside, the print statement is slow, so keep that in mind. It might actually be faster to have a single memory-mapped file for the whole thing, and then just append the error and traceback to the file. The built-in traceback library can be very useful for that. That&#x27;s also a bit more realistic, since obviously IRL you wouldn&#x27;t be using a print statement to keep track of errors. On a similar note, because file access is so slow, you&#x27;d be best off figuring out some way to remove the part where the server accesses the disk once per connection entirely. On a real-world system you&#x27;d possibly use some kind of memory caching system to do that, especially if you&#x27;re just reading files and not writing them. That allows you to use a little more memory (potentially as little as enough to have a single copy of the file in memory) to drastically improve performance.