兵马俑是专业使用的吗?

发布于 2024-09-17 19:01:09 字数 640 浏览 14 评论 0原文

今天在工作中,我和我的同事和老板讨论了无状态/有状态bean(我们刚刚完成了一个使用JSF的项目,这是公司里第一次有人做与JSF相关的事情),我的老板说他不这样做不太喜欢会话范围的bean(甚至对话/KeepAlive范围的bean)。他的论点之一是,如果我们有 4 个 Tomcat,并且有来自用户的请求,那么我们并不确定它每次都会被同一个 Tomcat“捕获”,问题是,如果在第一次收到请求并创建会话 bean 时,它仅在该 Tomcat 上创建,其他 Tomcat 不知道。

他提到的解决方案之一是所谓的“粘性会话”,它强制来自给定用户的请求每次都由同一个 Tomcat 处理。根据他的说法,第二个解决方案是将所有数据存储在“视图”中,但这意味着将整个状态存储在 POST 中,不知怎的,我不太喜欢这个想法。然后他提到将状态存储在数据库中,并在需要它的请求到达时查询它。我认为这会对性能造成巨大的影响,但他说这真的不会是一个问题,因为数据库应该为此类任务做好准备。

我感兴趣的最后一个解决方案是 Terracotta Server,据他告诉我们,它应该存储所有 Tomcat 的会话 bean(与其同步,然后如果有请求进来,它们会在其中查找会话 bean)红陶)。看起来有点酷并且可扩展,但他说他并没有真正看到它在大型专业系统中使用过,是吗?我尝试了一些关于它的信息但失败了,Terracotta 是否有什么问题阻止人们使用它?

Today at work I had a discussion with my co-workers and my boss about stateless / stateful beans (we just finished a project using JSF, it was the first time anyone at this company did something JSF related) and my boss said that he doesn't really like Session scoped beans (or even conversation / KeepAlive scoped ones). One of his arguments was that if we have for example 4 Tomcats and there is a request from the user then we aren't really sure that it will be "captured" by the same Tomcat every single time and the problem is that if during the first time a request comes and a session bean is created it's created only on that one Tomcat and the others don't know about it.

One of the solutions he mentioned was a so called "sticky session" which enforces requests from a given user to be handled by the same Tomcat every time. A second solution according to him would be storing all the data in the "view", but that would mean storing the whole state in the POST, somehow I don't really like that idea. Then he mentioned storing the state in the DB and querying it if a request that requires it arrives. I thought that it would be a really huge performance hit, but he said that it really wouldn't be a concern since the DBs should be prepared for such tasks.

The last solution which I'm interested in was the Terracotta Server which, from what he told us, is supposed to store the session bean for all Tomcats (which are synchronized with it and then if a requests comes in they look for session beans inside Terracotta). Seems kinda cool and scalable, but he said that he didn't really see it ever used in large professional systems, is that right? I tried some info on it but failed, is there something wrong with Terracotta that stops people from using it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

意中人 2024-09-24 19:01:09

它由专业人士使用,只需查看他们的客户页面即可。

http://www.terracotta.org/company/customers?src=/索引.html

It is used by professionals, just look a their customers page.

http://www.terracotta.org/company/customers?src=/index.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文