Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Tornado is a single threaded non blocking server. </p> <p>What this means is that if you make any blocking calls on the main thread you will eventually kill performance. You might not notice this at first because each database call might only block for 20ms. But once you are making more than 200 database calls per seconds your application will effectively be locked up. </p> <p>However that's quite a few DB calls. In your case that would be 200 people hitting send on their chat message in the same second. </p> <p>What you probably want to do is use a queue with a non blocking API. So Tornado receives a chat message. You put it on the queue to be saved to the database by another process, then you send the chat message back out to the other chat members. </p> <p>When someone connects to a chat session you also need to send off a request to the queue for all the previous messages, when the queue responds you send those off to the newly connected user. </p> <p>That's how I would approach the problem anyway. </p> <p>Also see this question and answer: <a href="https://stackoverflow.com/questions/12234998/any-suggestion-for-using-non-blocking-mysql-api-on-tornado-in-python3">Any suggestion for using non-blocking MySQL api on Tornado in Python3?</a></p> <p>Just remember, Tornado is single threaded. It's amazing. And can handle thousands of simultaneous connections. But if code in one of those connections blocks for 1 second then <strong>NOTHING</strong> else will be done for any other connection during that second. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload