1
This example shows the need of multithreading in the Pyro server.
2
The client spawns serveral concurrent loops which access the same
3
remote object. If the Pyro server is single threading, each remote
4
invocation has to wait for the previous one to complete.
5
If the Pyro server is multithreading, each remote invocation is
6
processed simultaneously.
9
If your server is I/O bound, you may successfully run several
10
requests at the same time without noticable delay (because the
11
I/O gets executed in parallel).
13
If your sever is CPU bound, you may notice that the multithreading
14
has no effect, because the CPU is busy 100%. If you are lucky and
15
have multiple CPUs, you may experience speedup after all. But
16
no more than the number of cpus you have.
19
Thread Local Storage (TLS): the server access Pyro's TLS feature.
20
If you're running in single-threaded mode you'll see that the
21
counter is shared among all invocations (because there is only
22
one thread) and that it increases with each invocation.
23
If running multithreaded, you'll see that each caller/thread
24
has its own TLS and that the counters are increased independently.
25
The server also takes care of correct initialization of the TLS
26
by setting a custom initTLS function in the Daemon.