TRICKS
author viric@mandarina
Fri, 02 Oct 2009 20:42:47 +0200
changeset 280 d207fb747144
parent 278 1698b327528d
permissions -rw-r--r--
Updating the manual for TS_MAXCONN
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
     1
System wide queue
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
     2
-------------------------
79
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
     3
You can set the $TS_SOCKET variable to the same name path for all your
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
     4
'ts' processes, and then
57
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
     5
they'll use the same socket for intercommunication. This means - single queue.
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
     6
You should be certain that any 'ts' can read/write to that socket, using
79
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
     7
chmod.
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
     8
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
     9
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    10
A queue for each resource
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    11
-------------------------
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    12
You can use $TS_SOCKET and aliases/scripts for having different queues for
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    13
different resources. For instance, using bash:
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    14
alias tsdisk='TS_SOCKET=/tmp/socket.disk ts'
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    15
alias tsram='TS_SOCKET=/tmp/socket.ram ts'
f99c2548fac4 Updated tricks.
viric@llimona
parents: 57
diff changeset
    16
alias tsnet='TS_SOCKET=/tmp/socket.net ts'
57
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    17
165
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    18
You can also create shell scripts like this:
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    19
<< FILE ts2
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    20
#!/bin/sh
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    21
export TS_SOCKET=/tmp/socket-ts2.$USER
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    22
ts "$@"
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    23
>> END OF FILE ts2
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    24
57
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    25
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    26
Be notified of a task finished
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    27
-------------------------
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    28
In X windows, inside bash, after submitting the task, I use:
ab48625beecb Added a compilation of tricks.
lbatlle@npdl268.bpo.hp.com
parents:
diff changeset
    29
$ ( ts -w ; xmessage Finished! ) &
165
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    30
7b914d4003c2 Fixing licenses in some files, and updating some documents.
viric@mandarina
parents: 79
diff changeset
    31
183
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    32
Killing process groups
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    33
-------------------------
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    34
ts creates a new session for the job, so the pid of the command run can be
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    35
used as the process group id for the command and its childs. So, you can use
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    36
something like:
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    37
$ kill -- -`ts -p`
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    38
in order to kill the job started and all its childs. I find it useful when
95d49e8a8cec Updating 'help' and some other related files to 0.5
viric@llimona
parents: 165
diff changeset
    39
killing 'make's.
278
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    40
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    41
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    42
Limiting the number of ts processes
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    43
-------------------------
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    44
Each queued job remains in the system as a waiting process. On environments
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    45
where the number of processes is quite limited, the user can select the amount
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    46
of the maximum number of ts server connections to ts clients. That will be
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    47
read from the environment variable TS_MAXCONN at the server start, and cannot be
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    48
set again once the server runs:
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    49
$ ts -K     # we assure we will start the server at the next ts call
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    50
$ TS_MAXCONN=5 ts
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    51
Internally there is a maximum of 1000 connexions that cannot be exceeded without
1698b327528d Adding the limit of ts connections
viric@mandarina
parents: 269
diff changeset
    52
modifying the source code (server.c).