• Post Reply Bookmark Topic Watch Topic
  • New Topic

(architecture) threading, memcached ... etc  RSS feed

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 address
  • destination 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
    Posts: 45
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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!
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!