| Author |
(architecture) threading, memcached ... etc
|
Pho Tek
Ranch Hand
Joined: Nov 05, 2000
Posts: 757
|
|
Goal For the purpose of this post, let's just say I'm trying to design a system that sends email. Description The client enters: source email addressdestination email address However the system will only accept a request if there is no pending request with the same source email address. Basically it takes about 30 seconds and maybe longer to complete a request! e.g. Request #1 ( me@foo.com to she@some.info ) is accepted and now pending. If I submit a new request ( me@foo.com to him@here.org ) before the first request completes, system will reject it. Current thoughts I can easily do a sychronization on the source email address like this: However this will not work in a cluster of webservers. What are my alternatives ? Regards, Pho
|
 |
Nick Kelly
Ranch Hand
Joined: Jan 28, 2005
Posts: 45
|
|
Hi Pho, I assume if you're using a cluster of web servers you will have some sort of database to store information in? If so, you could have a database table to hold pending request details. Each time you receive a request to send an email you would check if there is already a corresponding row in the pending request table. If there is you reject it. If not, you add a row for it and then send the email. When the email is sent you delete the row from the pending request table. Hope that helps!
|
 |
 |
|
|
subject: (architecture) threading, memcached ... etc
|
|
|