Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » One service instance for all clients?
One service instance for all clients? [message #23350] Mon, 23 March 2009 09:57 Go to next message
Henzler Peter is currently offline Henzler Peter
Messages: 19
Registered: July 2009
Junior Member
Hi
I was quite surprised when I found out, that each Service has only one
instance in a single thread running and every client is accessing this
same instance in only one thread.

That would mean that the bottleneck of my riena application whould be if
many different clients would call the same service?

Am I right with my assumtion that:
- a service can only be used from one client at the same time?
(ClientB would have to wait until ClientA got it's call of a method of
Service X finished.)
- that ClientB can't excecute method B in service X until clientA has
returned from it's call of methodA

If that is really true, I fear that this will lead to performance issues
very soon in a multi-client-environment with heavy load.

Thank you for your answer.

Best regards
Peter Henzler
Re: One service instance for all clients? [message #23436 is a reply to message #23350] Tue, 24 March 2009 00:34 Go to previous messageGo to next message
Christian Campo is currently offline Christian Campo
Messages: 590
Registered: July 2009
Senior Member
No of course not. If you use a local OSGi Service (which is something that is unrelated to Riena) you have a single
instance but you are performing calls in the Thread that you are currently in. I am sure that you already know that the
fact that there is only one instance for a service does not mean that you cant perform multiple calls at the same time.
These two are unrelated and its important to understand that.

Nothing waits if ClientA calls a local service and ClientB also calls the same local service.

The remote service model is the same. The webserver opens a thread for each call and again on the server there is only
one instance of the OSGi Service but it can be called by an unlimited number of clients at the same time. Of course this
also means that you can not keep client releated data in instance variables but you have to keep them if necessary in
local variables within the method. But that is also true for local OSGi services which can also be called by multiple
threads at the same time.....

Does that answer your question ?

christian campo

Henzler Peter schrieb:
> Hi
> I was quite surprised when I found out, that each Service has only one
> instance in a single thread running and every client is accessing this
> same instance in only one thread.
>
> That would mean that the bottleneck of my riena application whould be if
> many different clients would call the same service?
>
> Am I right with my assumtion that:
> - a service can only be used from one client at the same time?
> (ClientB would have to wait until ClientA got it's call of a method of
> Service X finished.)
> - that ClientB can't excecute method B in service X until clientA has
> returned from it's call of methodA
>
> If that is really true, I fear that this will lead to performance issues
> very soon in a multi-client-environment with heavy load.
>
> Thank you for your answer.
>
> Best regards
> Peter Henzler
>
>
Re: One service instance for all clients? [message #23477 is a reply to message #23350] Tue, 24 March 2009 00:34 Go to previous messageGo to next message
Christian Campo is currently offline Christian Campo
Messages: 590
Registered: July 2009
Senior Member
No of course not. If you use a local OSGi Service (which is something that is unrelated to Riena) you have a single
instance but you are performing calls in the Thread that you are currently in. I am sure that you already know that the
fact that there is only one instance for a service does not mean that you cant perform multiple calls at the same time.
These two are unrelated and its important to understand that.

Nothing waits if ClientA calls a local service and ClientB also calls the same local service.

The remote service model is the same. The webserver opens a thread for each call and again on the server there is only
one instance of the OSGi Service but it can be called by an unlimited number of clients at the same time. Of course this
also means that you can not keep client releated data in instance variables but you have to keep them if necessary in
local variables within the method. But that is also true for local OSGi services which can also be called by multiple
threads at the same time.....

Does that answer your question ?

christian campo

Henzler Peter schrieb:
> Hi
> I was quite surprised when I found out, that each Service has only one
> instance in a single thread running and every client is accessing this
> same instance in only one thread.
>
> That would mean that the bottleneck of my riena application whould be if
> many different clients would call the same service?
>
> Am I right with my assumtion that:
> - a service can only be used from one client at the same time?
> (ClientB would have to wait until ClientA got it's call of a method of
> Service X finished.)
> - that ClientB can't excecute method B in service X until clientA has
> returned from it's call of methodA
>
> If that is really true, I fear that this will lead to performance issues
> very soon in a multi-client-environment with heavy load.
>
> Thank you for your answer.
>
> Best regards
> Peter Henzler
>
>
Re: One service instance for all clients? [message #23518 is a reply to message #23436] Tue, 24 March 2009 02:18 Go to previous message
Henzler Peter is currently offline Henzler Peter
Messages: 19
Registered: July 2009
Junior Member
Yes, that helps.

I guess I ended up on the same thread every time, because the thread was
pooled by the webserver and reused for the calls from the different
clients.

Thank you very much.
Re: One service instance for all clients? [message #581442 is a reply to message #23350] Tue, 24 March 2009 00:34 Go to previous message
Christian Campo is currently offline Christian Campo
Messages: 590
Registered: July 2009
Senior Member
No of course not. If you use a local OSGi Service (which is something that is unrelated to Riena) you have a single
instance but you are performing calls in the Thread that you are currently in. I am sure that you already know that the
fact that there is only one instance for a service does not mean that you cant perform multiple calls at the same time.
These two are unrelated and its important to understand that.

Nothing waits if ClientA calls a local service and ClientB also calls the same local service.

The remote service model is the same. The webserver opens a thread for each call and again on the server there is only
one instance of the OSGi Service but it can be called by an unlimited number of clients at the same time. Of course this
also means that you can not keep client releated data in instance variables but you have to keep them if necessary in
local variables within the method. But that is also true for local OSGi services which can also be called by multiple
threads at the same time.....

Does that answer your question ?

christian campo

Henzler Peter schrieb:
> Hi
> I was quite surprised when I found out, that each Service has only one
> instance in a single thread running and every client is accessing this
> same instance in only one thread.
>
> That would mean that the bottleneck of my riena application whould be if
> many different clients would call the same service?
>
> Am I right with my assumtion that:
> - a service can only be used from one client at the same time?
> (ClientB would have to wait until ClientA got it's call of a method of
> Service X finished.)
> - that ClientB can't excecute method B in service X until clientA has
> returned from it's call of methodA
>
> If that is really true, I fear that this will lead to performance issues
> very soon in a multi-client-environment with heavy load.
>
> Thank you for your answer.
>
> Best regards
> Peter Henzler
>
>
Re: One service instance for all clients? [message #581450 is a reply to message #23350] Tue, 24 March 2009 00:34 Go to previous message
Christian Campo is currently offline Christian Campo
Messages: 590
Registered: July 2009
Senior Member
No of course not. If you use a local OSGi Service (which is something that is unrelated to Riena) you have a single
instance but you are performing calls in the Thread that you are currently in. I am sure that you already know that the
fact that there is only one instance for a service does not mean that you cant perform multiple calls at the same time.
These two are unrelated and its important to understand that.

Nothing waits if ClientA calls a local service and ClientB also calls the same local service.

The remote service model is the same. The webserver opens a thread for each call and again on the server there is only
one instance of the OSGi Service but it can be called by an unlimited number of clients at the same time. Of course this
also means that you can not keep client releated data in instance variables but you have to keep them if necessary in
local variables within the method. But that is also true for local OSGi services which can also be called by multiple
threads at the same time.....

Does that answer your question ?

christian campo

Henzler Peter schrieb:
> Hi
> I was quite surprised when I found out, that each Service has only one
> instance in a single thread running and every client is accessing this
> same instance in only one thread.
>
> That would mean that the bottleneck of my riena application whould be if
> many different clients would call the same service?
>
> Am I right with my assumtion that:
> - a service can only be used from one client at the same time?
> (ClientB would have to wait until ClientA got it's call of a method of
> Service X finished.)
> - that ClientB can't excecute method B in service X until clientA has
> returned from it's call of methodA
>
> If that is really true, I fear that this will lead to performance issues
> very soon in a multi-client-environment with heavy load.
>
> Thank you for your answer.
>
> Best regards
> Peter Henzler
>
>
Re: One service instance for all clients? [message #581464 is a reply to message #23436] Tue, 24 March 2009 02:18 Go to previous message
Henzler Peter is currently offline Henzler Peter
Messages: 19
Registered: July 2009
Junior Member
Yes, that helps.

I guess I ended up on the same thread every time, because the thread was
pooled by the webserver and reused for the calls from the different
clients.

Thank you very much.
Previous Topic:One service instance for all clients?
Next Topic:No authentication service
Goto Forum:
  


Current Time: Mon Sep 01 19:50:09 EDT 2014

Powered by FUDForum. Page generated in 0.01882 seconds