Hi,
We are developing an e-commerce site in ROR. We have a table which
stores the prices of our products. To save on repeated database
queries, we read the table and store it in memory.
As the admin can change the prices through the management console we
are facing the problem of updating the in-memory data. We are running
the application on mutiple servers,with multiple instances of mongrels
serving the requests. Thus all the mongrels have their own copy of the
in-memory data.
Now we think there are few issues
1. We would need to update it on every mongrel.
2. We don''t want the scene where there are different servers/mongrels
have different version of the pricing.
3. We are hoping there is some way where we won''t need to shut down
the whole site !
We tried to use the SEE-SAW. but i think it doesn''t take the business
of mongrels into account. Thus if one of the mongrels is serving a
long request while it receives the restart request, things go wrong
and the mongrel dies in the end.
We have been discussing this issue and come up with the following
solution.
1. Copy the prices to the user''s session (which is anyway read every
time) and use that to create the shopping cart etc.
2. Update the each of the mongrels through an http request/ web
service.
This way the user will see only one version of the prices throughout
his transaction.
But this again has some problem. What if a user somehow keeps his
session to be alive for a very long duration ( if he knows the pending
price update.) Even though we don''t keep persistent shopping cart, a
malicious user can, though a script, keep his session alive for days/
weeks or even months and thus use the old prices. We did use this
trick for our online submission of assignments in college ;)
As a last resort we can check the staleness of session prices in the
last checkout step.
We think this is a common problem and every e-commerce site should be
facing this but can''t seem to find any published solution. We are
hoping some can put some light or point us in the right direction. Any
help would be appreciated
A.K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---