应用程序服务器是否为来自同一用户的每个请求创建新线程? [英] Does application server create new thread for each request from same user?

查看:211
本文介绍了应用程序服务器是否为来自同一用户的每个请求创建新线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是简单的情况:

用户从Web应用程序的网页触发一些操作.此操作很繁琐,并且需要更多时间.

User triggers some operation from a web page of the web application. This operation is heavy one and takes some more time.

在服务器端完成该操作之前,用户触发器会说具有一些不同参数的相同操作.因此第二个请求的第二个操作也将开始处理.

And before the operation is completed on server side, user triggers say same operation with some different parameters. so the second operation for second request will also start processing.

因此,在这种情况下,是否有两个不同的线程,例如第一个线程处理第一个请求,另一个线程处理第二个请求?还是只是一个线程同时处理了请求,并且为了执行第二个请求,第一个操作才被中断(未完成)?

So in this case, are there two different threads like 1st one processing first request and other for 2nd request ? or it's just one thread processing both the requests and first operation is just interrupted (left uncompleted) for sake of execution for second request ?

在这里,我不想避免用​​户多次请求相同的操作.只想知道它是如何工作的.

Here I don't want to avoid user requesting same operation multiple times. Just want to know how it works.

这可能是一个愚蠢的问题,但是我对此一点困惑.而我正在发生的事情加剧了混乱.对我来说,似乎第一个请求的操作尚未完成.

This might be a silly question but i am little confused with this. And what is happening with me is adding into the confusion. For me it seems like operation for 1st request is not getting completed.

这是Websphere应用程序服务器,如果有帮助的话.

It's Websphere application server, if that helps.

推荐答案

WebSphere Web Container对所有请求使用线程池.

WebSphere Web Container uses a Thread Pool for all the requests.

对于任何请求(无论是谁提出的),都会从池中获取一个线程,对该请求进行处理,然后该线程返回到池中.

For any request (doesn't matter who made it) a thread is obtained from the pool, the request is processed, and the thread goes back to the pool.

即使请求是一个接一个的,也不能保证同一线程将处理它们.

Even if the requests are one after the other, there is no guarantee the same thread will process them.

如果您看到一个请求干扰另一个请求,则很可能是您在代码中执行的操作,而不是因为WebSphere的行为.

If you see one request interfere with another it is most likely something you do in your code and not due to how WebSphere behaves.

这篇关于应用程序服务器是否为来自同一用户的每个请求创建新线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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