Stateless vs StateFul server

2016-11-11  本文已影响176人  canezk
  1. COOKIE
    其实一般的cookie已经属于是stateful了,但是很多web server借助类似于redis这些来实现全局session,所以可以简单认为这种web server是stateless的,因为request可以到任何一台机器;
  2. Transaction
    A stateless service is a service that does not store any data on the application
    server. It reads or writes data to the database, returns a value (or not), and after
    that, any information on the task itself is forgotten.
    A stateful service is used to perform transactions, that is a series of tasks that depend on the result of preceding tasks. The easiest example is sending an order at a web store, where you gather your products in a shopping cart, and when you check out, you enter your account data on one page, store it, then enter your billing address, store it, then confirm your order and conclude the transaction. Each step depends on the successful outcome of the preceding step, and data needs to be preserved until the last one of these steps is completed or the transaction is canceled, in which case there has to be a rollback to restore your account balance to the way it was before you checked out.
上一篇 下一篇

猜你喜欢

热点阅读