search

Home  >  Q&A  >  body text

php - When the master server sends a message to the slave server, how to ensure that the message will arrive and then limit the time (such as within 5 seconds)?

The last time I was interviewed by a Java company, I was asked, how to ensure reliability and time?

世界只因有你世界只因有你2753 days ago392

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:15:42

    There are many factors, there is no way to guarantee delivery within 5 seconds:

    • The network is down, can it be delivered within 5 seconds?

    • The server is hanging and cannot receive data

    • The server is down and the data cannot be received

    • The server is too busy to process, and the thread that receives the message has not been executed in time

    As long as the service can be connected, or even if the service is disconnected and reconnected, MQ can ensure that the message is sent to the message recipient as soon as possible, but the specific time is as mentioned above, depending on whether the service can be accessed and the service processing capability

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:15:42

    Set error callback mechanism, timeout callback, and arrival callback. Or use an MQ queue.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-16 13:15:42

    timeout 5s No waiting for overdue items

    reply
    0
  • Cancelreply