Parallel requests be processed parallel/sequential by one Spring singleton bean -
i have refered these links still has doubt
concurrent request singleton bean
another less relevant link
my q/doubt : parallel requests processed parallel/sequential 1 spring singleton bean[as 1 object/instance] e.g. @controller, @service on multi-core processor(parallel thread execution capability)
hopefully not, how works.
first link, got understanding - 1 singleton bean object, 1 instance of byte code of singeton bean - accessed thread stack independently - not able corelate
will parallel requests processed parallel/sequential 1 spring singleton bean e.g. e.g. @controller, @service ?
the requests @controller
, @service
processed parallelly different threads created j2ee container. number of threads can created j2ee container limited memory availability.
a single object can serve number of requests (limited memory available mentioned above).
to understand concept better, can take spring mvc's dispatcherservlet
(or servlet
default behavior), singleton object created servlet container, @ same time each servlet can concurrently process multiple requests (coming users/clients).
so, if wanted control number of requests processed singleton bean object (service
/controller
/dao
, whichever object), requests need throttled or add synchronization methods (or critical section) of bean. but, in general, not recommended this, unless have got issues or deal atomicity (handling multiple transactions single unit of work).
Comments
Post a Comment