Hindhustani Posted January 28, 2023 Report Posted January 28, 2023 1. In a typical producer/consumer problem with queue example, where producer feeds the data to queue and consumer consumes the data from queue. If the application was deployed in multiple nodes for high scalability and availability. That means producers and consumers are from multiple JVMs from different servers ?. How does semaphore and mutex control sharing the resource here between threads of the same JVM/Server and across JVM and servers? 2. Also in the case of ExecutorService, when multiple threads are executing. What if one thread hung up out of 5 threads? the remaining 4 threads continue to work? What will happen to the hung up thread? @Vaampire @ramudu @dasari4kntr @csrcsr Quote
csrcsr Posted January 28, 2023 Report Posted January 28, 2023 28 minutes ago, Hindhustani said: 1. In a typical producer/consumer problem with queue example, where producer feeds the data to queue and consumer consumes the data from queue. If the application was deployed in multiple nodes for high scalability and availability. That means producers and consumers are from multiple JVMs from different servers ?. How does semaphore and mutex control sharing the resource here between threads of the same JVM/Server and across JVM and servers? 2. Also in the case of ExecutorService, when multiple threads are executing. What if one thread hung up out of 5 threads? the remaining 4 threads continue to work? What will happen to the hung up thread? @Vaampire @ramudu @dasari4kntr @csrcsr first point peddaga ardam akaledu anna for the second point you can get the Future when you do the ExecutorService Submit when you use the future.get with predifined slaTimeout value you catch the TimeOutException and handle the logic 1 Quote
ramudu Posted January 29, 2023 Report Posted January 29, 2023 2 hours ago, Hindhustani said: 1. In a typical producer/consumer problem with queue example, where producer feeds the data to queue and consumer consumes the data from queue. If the application was deployed in multiple nodes for high scalability and availability. That means producers and consumers are from multiple JVMs from different servers ?. How does semaphore and mutex control sharing the resource here between threads of the same JVM/Server and across JVM and servers? 2. Also in the case of ExecutorService, when multiple threads are executing. What if one thread hung up out of 5 threads? the remaining 4 threads continue to work? What will happen to the hung up thread? @Vaampire @ramudu @dasari4kntr @csrcsr I will try to answer later bro , I am outside 1 Quote
Hindhustani Posted February 4, 2023 Author Report Posted February 4, 2023 On 1/28/2023 at 8:37 PM, ramudu said: I will try to answer later bro , I am outside Bro any inputs? Quote
hunkyfunky2 Posted February 5, 2023 Report Posted February 5, 2023 On 1/28/2023 at 6:01 PM, Hindhustani said: 1. In a typical producer/consumer problem with queue example, where producer feeds the data to queue and consumer consumes the data from queue. If the application was deployed in multiple nodes for high scalability and availability. That means producers and consumers are from multiple JVMs from different servers ?. How does semaphore and mutex control sharing the resource here between threads of the same JVM/Server and across JVM and servers? 2. Also in the case of ExecutorService, when multiple threads are executing. What if one thread hung up out of 5 threads? the remaining 4 threads continue to work? What will happen to the hung up thread? @Vaampire @ramudu @dasari4kntr @csrcsr No, producer or consumer jvm processes doesn't spam servers - they are all separate. Mutex, semaphore are within process only. If you are trying to solve " read once" or "transaction" problems, then you solve with distributed patterns - ex : saga. Also, in many cases you use distributed architecture when you don't care about transactions in traditional ways - - message may be lost, don't care : ex: weather or sensor feed. It's okay if you you lose one or two messages - or transactions are handled by business logic - either with DB locks or etc Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.