是否认为无状态协议比有状态协议更适合使用? [英] Are stateless protocols considered better to use over stateful protocols?

查看:88
本文介绍了是否认为无状态协议比有状态协议更适合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以看到,有状态协议可以减少像cookie那样的模拟状态".

I can see that stateful protocols lead to less botched together 'emulated state' like cookies.

但是要确保实现正确并重新连接,测试变得更加困难,并且会话连续性可能很难处理.

but testing becomes a lot harder to ensure that your implementation is correct and reconnects, and session continuations can be very hard to handle.

始终使用无状态协议是否被认为是更好的做法,或者它确实是特定于域的?

Is it considered better practice to always use stateless protocols, or is it really domain specific?

我认为,在处理有状态协议时,身份验证会变得更加容易,但是还有其他原因应使用有状态协议吗?

I think that authentication becomes easier when dealing with stateful protocols, but are there any other reasons you should use a stateful protocol?

推荐答案

状态对您的应用程序有多重要?您是否需要在不同机器之间保持恒定的数据流,或者爆发更有用吗?如果您正在编写IP电话类型的应用程序,那么您可能会想要一些相当有状态的东西,如果您可以摆脱无状态的话,这样做可能会更便宜,更容易.有状态地执行操作必然会更脆弱,因为如果连接的任一端断开或连接本身断开,则可能会丢失数据,而使用无状态连接时,您更有可能只需要等待一段时间并尝试再次.

How important is state to your application? Do you need a constant flow of data between different machines or is it more useful to have bursts? If you're writing an IP Telephony type application then you're probably going to want something fairly stateful, if you can get away with stateless it's likely to be cheaper and easier to do it that way. Doing things statefully is necessarily more fragile because if either end of the connection gets dropped or the connection itself goes down you run a higher risk of data loss, whereas with a stateless connection you are more likely just to have to wait for a while and try again.

对于不同的工作,它们确实是不同的工具,但是鉴于在线无状态技术的简便性和普遍性,因此在您有选择的情况下朝这个方向看是合乎逻辑的.

They really are different tools for different jobs, but given the ease and ubiquity of stateless technologies online it's logical to look in that direction when you have the option.

这篇关于是否认为无状态协议比有状态协议更适合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆