Do Interval tasks run in their own thread?
Do Interval tasks run in their own thread?
My understanding is the server is single-threaded.
Are intervals handled in the same single-threaded environment as user requests or do they run in a separate thread?
If in a separate thread, does each interval run in its own thread or do all intervals share a single thread?
Thanks in advance.
Are intervals handled in the same single-threaded environment as user requests or do they run in a separate thread?
If in a separate thread, does each interval run in its own thread or do all intervals share a single thread?
Thanks in advance.
No, it's multi threaded, but it does not use the one-thread-per-client model.My understanding is the server is single-threaded.
With the default configuration the server should use 10 threads
Each interval is a separate threadAre intervals handled in the same single-threaded environment as user requests or do they run in a separate thread?
Each interval is a separate threadIf in a separate thread, does each interval run in its own thread or do all intervals share a single thread?
Intervals from a java extension
hi Lapo,
what is the syntax to use Intervals from a java extension?
thank you for your help,
best regards,
elmo
what is the syntax to use Intervals from a java extension?
thank you for your help,
best regards,
elmo
-
jflowers45
- Posts: 63
- Joined: 11 Jul 2006, 20:52
Lapo -
I'm a little confused. I had read your response to NateDog's earlier questions about threading here
http://www.gotoandplay.it/_forums/viewtopic.php?t=2291
and they *seem* to conflict with the answer you just gave. Mainly we're worried about whether we need to avoid race conditions. Can you elaborate?
The reason we started wondering about this is that we are having a problem in our game where users are seeing other users' inventories instead of their own while being logged in, and we can't figure out how it's happening. It doesn't happen too often but it hasn't been a one time thing either.
Thanks!
I'm a little confused. I had read your response to NateDog's earlier questions about threading here
http://www.gotoandplay.it/_forums/viewtopic.php?t=2291
and they *seem* to conflict with the answer you just gave. Mainly we're worried about whether we need to avoid race conditions. Can you elaborate?
The reason we started wondering about this is that we are having a problem in our game where users are seeing other users' inventories instead of their own while being logged in, and we can't figure out how it's happening. It doesn't happen too often but it hasn't been a one time thing either.
Thanks!
How you doin?
mmm... no they don'tand they *seem* to conflict with the answer you just gave.
He asked about the general architecture of the server and I explained that, by default, the custom extensions run in a single thread.
Of course if you do add threads by running intervals or java timers/threads you will have to pay attention to possible race conditions.
I don't know ... this seems a problem with some wrong user id that leads to reading the wrong dataThe reason we started wondering about this is that we are having a problem in our game where users are seeing other users' inventories instead of their own while being logged in,
Here's our understanding ...
1) I understand that the intervals will each run in a separate thread.
2) Since our game is written as a custom extension, it runs in a single thread.
So I'm not clear then what the setting in the config file controls. Does it limit the overall number threads for all intervals and extensions for the entire server?
1) I understand that the intervals will each run in a separate thread.
2) Since our game is written as a custom extension, it runs in a single thread.
So I'm not clear then what the setting in the config file controls. Does it limit the overall number threads for all intervals and extensions for the entire server?
Correct1) I understand that the intervals will each run in a separate thread.
I will try to be more precise here. I went back to the code to review a couple of aspects of the server architecture.2) Since our game is written as a custom extension, it runs in a single thread.
All the requests handled in the handleRequest() method are executed by the same thread, while the events are dispatched by another thread.
If you're using Actionscript this shouldn't give you problems. If you're writing extensions in Java you will probably have to synchronize shared resources. (collections, files etc...)
Hope it helps
-
jflowers45
- Posts: 63
- Joined: 11 Jul 2006, 20:52
Many of the threads used internally are private and can't be modified from outside (acceptor thread, reader thread, disconnector thread etc...)
You can however add more threads to the "Socker Writer stage" which is backed by a thread pool, by default set to 1.
You should also understand that running many concurrent threads in a JVM adds some overhead to the execution due to the thread switching.
We usually recommend to alter the number of threads only in particular cases, for example when using multi-cpu machines (quad CPU or more)
You can read more in chapter 2.2. of our docs
You can however add more threads to the "Socker Writer stage" which is backed by a thread pool, by default set to 1.
You should also understand that running many concurrent threads in a JVM adds some overhead to the execution due to the thread switching.
We usually recommend to alter the number of threads only in particular cases, for example when using multi-cpu machines (quad CPU or more)
You can read more in chapter 2.2. of our docs
Hi Lapo,
I'm writing a multi user game where about 20 users in the same room compete over a single resource (a Frisbee) - Ultimate Frisbee if you are familiar with the game.
I'm using a Java room extension and handleRequest method.
Sorry for nagging, but I want be be 100% sure.
Will all user requests arriving to the extension be handled serially in the order of their arrival?
Are no sych locks required?
Doesn't it affect the extension performance in a high traffic env?
If a room is created on the fly and uses the same extension class does it share the same instance of the extension more rooms that deploy this extension?
Thanks
I'm writing a multi user game where about 20 users in the same room compete over a single resource (a Frisbee) - Ultimate Frisbee if you are familiar with the game.
I'm using a Java room extension and handleRequest method.
Sorry for nagging, but I want be be 100% sure.
Will all user requests arriving to the extension be handled serially in the order of their arrival?
Are no sych locks required?
Doesn't it affect the extension performance in a high traffic env?
If a room is created on the fly and uses the same extension class does it share the same instance of the extension more rooms that deploy this extension?
Thanks