Results 1 to 7 of 7
  1. #1
    Join Date
    May 2012
    Posts
    3
    Plugin Contributions
    0

    Default stateless or stateful?

    Does Zen Cart store any state on the server?

    If I need to run multiple servers will I be required to have sticky sessions?

  2. #2
    Join Date
    Jan 2004
    Posts
    60,552
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: stateless or stateful?

    It is unclear from your post what your specific "business question" is. You've jumped to a technical question without explaining anything about the business requirement which has led you to that technical question.

    What exactly do *you* mean by "multiple servers" and "sticky sessions"? Those are terms that some people throw around without understanding the larger picture. Answering your question without a complete understanding of what you're really asking, and why, would be doing you a disservice.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  3. #3
    Join Date
    May 2012
    Posts
    3
    Plugin Contributions
    0

    Default Re: stateless or stateful?

    Quote Originally Posted by DrByte View Post
    It is unclear from your post what your specific "business question" is. You've jumped to a technical question without explaining anything about the business requirement which has led you to that technical question.
    Fair enough. I plan to build out this site with redundancy in order to avoid single point of failure. There will be 2 servers behind a firewall both pointing to a database cluster. If I use zen cart and it is not stateless, I will need to understand what information is stored in the session and determine how I can distribute or replicate the session.

    Quote Originally Posted by DrByte View Post
    What exactly do *you* mean by "multiple servers" and "sticky sessions"? Those are terms that some people throw around without understanding the larger picture. Answering your question without a complete understanding of what you're really asking, and why, would be doing you a disservice.
    By multiple servers, I mean that I will install a load balancer and will have at least 2 web servers running php & hosting the zen-cart code.

    By sticky sessions, I mean that the load balancer would have to be aware of which server the user landed on when they began their session and ensure that the user remain on that same server for their entire session. One of the problems here is that if the machine crashes any sessions on that machine would be lost and the user would have to start over.

    I am assuming that for Zen Cart most activity can happen without being logged in so perhaps this only impacts the user during the actual transaction period, however I'm still wanting to do some due diligence here. I would like to under stand what stat is stored on the server and what features depend on this state.

    My goal is to gather information on the forums then once I decide which cart is top on my list, I'm going to dig into the code and verify any assumptions I've made and or advice I've been given.

  4. #4
    Join Date
    Jan 2004
    Posts
    60,552
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: stateless or stateful?

    Out-of-the-box it is stateless insomuch as session info is stored in the database, thus able to be negotiated between the visitor's browser and whichever server they're hitting.

    If you are serving downloadable products and want to use the default delivery method of download-by-redirect (most efficient use of server resources), you will need to configure your load balancer to treat the logged-in customer with a sticky session. You could optionally use download-by-streaming and then it won't matter which server is doing the delivery, as long as both are in sync.

    From an administrative perspective, you will need to pick one server as your master for doing administrative work, and make sure that you replicate changed files to the other server afterward. This affects things like product images, downloadable products, media clips on music products, etc. You will also need to check both servers for debug/error logs, since each server will store its own logs independent of the other.

    The biggest problem I've seen with people setting up a database cluster is latency between webserver request and db-server response times, whether from improper physical architecture (bus is always faster than ethernet which is always faster than internet (ie: different datacenter)) or poorly-tuned database cluster servers, or both.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



  5. #5
    Join Date
    Sep 2004
    Posts
    1,391
    Plugin Contributions
    4

    Default Re: stateless or stateful?

    Running Zen Cart behind a load balancer works just like any other website in a Load Balance/High Availability setup.

    Couple things to think about (some of which you already have), for your benefit and those who will search-stumble in later...

    • If you store your Zen Cart sessions in the database (which is the default), there is no state information stored on the local filesystem. Therefore, as long as the boxes behind your LB point to the same DB, it doesn't matter which box your users connect to.
    • Most LB's do some kind of IP hash algorithm to make sure a user's requests end up at the same box, i.e. your "sticky sessions." If you make sure that both your boxes have an identical file set, this won't be an issue.
    • The most likely wrinkle that a typical store might run into is product downloads. Again, make sure they stay in sync with the rest of your site files and you'll be fine.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  6. #6
    Join Date
    May 2012
    Posts
    3
    Plugin Contributions
    0

    Default Re: stateless or stateful?

    Thanks for the help.

    Sounds like I could just use 1 of the ip addresses when making admin changes. Then have an rsync process that synchronizes the file system.

  7. #7
    Join Date
    Jan 2004
    Posts
    60,552
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: stateless or stateful?

    To some extent, yes. But as I mentioned, there are some things like errorlogs that are specific to each server, and a one-way rsync will lose those.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.



 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •