I have been reading and learning a lot about Tryton. One thing I have
noticed is that the trytond communicates with the client using what is
essentially HTTP. Correct me if I'm wrong please.
The point of this post is to ask the following questions:
1. As far as I know, the default Python (from python.org) doesn't
support multiple cpu cores. Therefore, even though trytond uses 1 thread
per user, a single trytond instance will only use a single CPU core.
Correct?
2. Does Trytond communicate with the tryton client using the HTTP?
3. Has anyone deployed trytond in production behind HTTP or other proxy?
In my experiments, I have modified trytond to accept two new options on the
command line, --jsonrpc-port (-j) and --xmlrpc-port (-x). I then use the
following script to start 3 instances. The same effect can be achieved with
3 different config files.
multi-trytond.sh
#!/bin/bash
MYDIR="$(dirname $0)"
VENV="${MYDIR}/../envs/env278"
DB=$1
source ${VENV}/bin/activate
for port in 9297 9298 9299; do
${VENV}/bin/trytond -j $port -x $[$port-1000] -c
$MYDIR/trytond.conf -d $DB \
--logfile=$MYDIR/log/trytond-${port}.log
--pidfile=$MYDIR/log/trytond-${port}.pid &
done
And then, on the server I have nginx running with this config:
...
upstream tryton_jsonrpc {
server 127.0.0.1:9299;
server 127.0.0.1:9298;
server 127.0.0.1:9297;
}
upstream tryton_xmlrpc {
server 127.0.0.1:8299;
server 127.0.0.1:8298;
server 127.0.0.1:8297;
}
server {
listen 8000;
server_name trytond.myweb;
ssl on;
ssl_certificate /var/local/trytond/.ssl/master-cert.pem;
ssl_certificate_key /var/local/trytond/.ssl/master-key.pem
location / {
proxy_pass http://tryton_jsonrpc;
}
}
server {
listen 8069;
server_name trytond.myweb;
ssl on;
ssl_certificate /var/local/trytond/.ssl/master-cert.pem;
ssl_certificate_key /var/local/trytond/.ssl/master-key.pem
location / {
proxy_pass http://tryton_xmlrpc;
}
}
I am working on a deployment now that will eventually see more than 300
clients connecting to a single trytond with well over a million party.party
records. There will be no reports generated on this instance but lots of
searches and lots of functional fields.
One thing I have noticed in my experiments thus far is that the client
never hangs. There are times when using tryton -> trytond and after a
period of inactivity (and laptop suspends), the client would hang and not
ask for password when I tried an action. However, using the tryton -> nginx
-> trytond, this doesn't happen (yet).
Based on my role (at work), I know I don't use tryton as much as some other
folks. So I'm sharing this here to get some comments and, if necessary, a
proper scolding.
---
MM