Home > Back-end >  When website development will use wait Notify?
When website development will use wait Notify?

Time:10-14

I had a wait notify the practice, but I don't know what website development will use this technique when
I feel only graphical desktop thread to interact with the background threads will use wait notify
Sites are resolved through distributed lock or airflow seems no use
Blockingqueue, atomic such a collection of exchanging data between threads, I don't know when website development would use the
The local cache static data?

Website development, by the way when would use the thread pool?
Connection pooling is a big probability used, thread pool, feel framework are exported, as if they didn't have enough place to write thread pool

CodePudding user response:

If your website just to add and delete, it may never use these things, but not all websites are to add and delete,

For example, such a demand, a text message website, the user can enter a phone number and message content, and then click send to send text messages to go out,

The back-end design:
Assumes that the system have a larger concurrency value, the system has designed a SMS to the buffer pool, click send only to write text message into the message buffer pool, and then there are multiple threads in a thread pool to get messages from the momentum buffer pool and actually sent out, then this can have the thread pool,
When sending thread found in the buffer pool message all have no, that in order to save system resources, the thread can wait first, when there is a new user click on the send buffer pool in the new message, you need to call the notify, send resume sending thread,

In fact this is also a typical producer consumer model,

CodePudding user response:

This scenario you usually use the message queue, and then use the distributed cluster service consumption to send text messages at the same time, if enough distributed server might use a thread pool, or according to the actual situation to choose the reasonable plan,

CodePudding user response:

Need to look at your website have push/pull, or PUB/SUB these patterns, it can use wait/notify

CodePudding user response:

reference KeepSayingNo reply: 3/f
need to look at your website have push/pull, or PUB/SUB these patterns, it can use wait/notify

I don't understand why should I change the pushpull distributed to wait the application of monomer/notify if mobile or desktop: of course, I can understand but if I don't know why I do the backend server

CodePudding user response:

Multithreaded situations, such as "producer - consumer model"
  • Related