jeffery9@gmail - eventdoveeventdove.com/resource/20141217/390537_20141217113224492.pdf ·...
TRANSCRIPT
预告
其他主题,敬请期待• Odoo安装与部署[Linux]• Odoo消息与邮件• Odoo Security• Odoo自动化• CRM客户关系管理• 销售管理• 采购管理• 库存管理• 会计与财务• 生产管理
• 补货• HR人力资源管理• 项目管理• 品质管理• 售后服务支持• 知识管理• 零售终端POS
2014/12/17 jeffery 2
Q:913547235
397750860
Odoo Architecture
Front-end pages Back-end JSclient
PostgreSQL Store
HTTP Routing
Business Logic (Apps)
Controllers (Front-end,Back-end)
Messaging,Notifications (mail)
ORM
UserInterface
Controllers
Models
Persistence
Deployment Architecture
Single server, multi-process
PostgreSQLStore
HTTP worker
HTTP worker
HTTP worker
Cron worker
gevent worker
Rule of thumb: --workers=$[1+$CORES*2]
Requests
Deployment Architecture
M ulti-server, multi-process
PostgreSQLStore
HTTP worker
HTTP worker
HTTP worker
Cron worker
gevent workerRequests
HTTP worker
HTTP worker
HTTP worker
Cron worker
gevent worker
Loadbalancer
o Is the real workhorse of your Odoo server
o Powers large cloud services
o Can handle terabytes of data efficiently
o Should be fine-tuned to use your hardware
o Cannot magically fix algorithmic/complexityissues in [y]our code!
PostgreSQL
o Use PostgreSQL 9.2/9.3 for performance
o Tune it:http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
o Avoid deploying PostgreSQL on a VM
o If you must,optimize the VM for IOPS
o Check out vFabric vPostgres9.2
o Use separate disks for SYSTEM /DATA/WAL
o shared_buffers:more than 55%VM RAM
o Enable guest memory ballooningdriver
PostgreSQL Deployment
o 2014 recommandation for singleuser server for up to ~100 activeusers
o Intel Xeon E5 2.5Ghz 6c/12t (e.g.E5-1650v2)
o 32GB RAM
o SATA/SAS RAID-1
o On Odoo online, this spec handles 3000dbs with a load average≤3
Hardware Sizing
o Typical read transaction takes ~100ms
o A single process can handle ~6t/s
o 8 worker processes =~50 t/s
o 1 interactive user =~50 t/mpeak =~1t/s
o Peak use with 100 users =100 t/s
o On average,5-10% of peak =5-10 t/s
Transaction Sizing
Linux• 支持multi processing• 稳定• 操作难
Windows• 操作容易• python有时会crash• 不支持multi processing
Linux Vs Windows
Linux 逼格高Windows 高富帅
Package – nightly build[http://nightly.odoo.com/]
• Deb• RPM• Windows installer
Source code - github [https://github.com/odoo/odoo]
• git repo• zip package
Package vs Source code
复杂,灵活性,方便控制,适合生产环境
简单,难以控制,适合测试
• Mobaxterm• Pgadmin
工具推荐
安装软件sudo apt-get update
sudo apt-get install openssh-serversudo apt-get install pythonsudo apt-get install postgresql
创建用户sudo adduser --system --home=/opt/odoo --group odoo
sudo su - postgrescreateuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
准备环境
/etc/postgresql/9.3/main [Ubuntu]PostgreSQL\9.3\data [Windows]
postgresql.conf# FILE LOCATIONSdata_directory = '/var/lib/postgresql/9.3/main‘hba_file = '/etc/postgresql/9.3/main/pg_hba.conf' ident_file = '/etc/postgresql/9.3/main/pg_ident.conf‘external_pid_file = '/var/run/postgresql/9.3-main.pid' listen_addresses = '*' port = 5432 max_connections = 100 unix_socket_directories = = '/var/run/postgresql‘
pg_hba.conf# IPv4 local connections:host all all 127.0.0.1/32 md5host all all x.x.x.x/x md5
PostgreSQL调整
Restart Service
Zip 源码包wget https://github.com/odoo/odoo/archive/8.0.zip
Git repositorygit clone https://www.github.com/odoo/odoo --depth 1
--branch 8.0 --single-branch .Or
git clone https://www.github.com/odoo/odoo
git pull # update to date
取得源码
apt-get update
apt-get install python-dateutil python-feedparser python-gdata python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabelpython-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil wget python-unittest2 python-mock python-jinja2 python-dev libpq-dev poppler-utilspython-pdftools python-pypdf python-setuptools python-pybabel
安装python lib [Ubuntu]
Ref. odoo/requirements.txt
安装python lib [windows]
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Ref. odoo/requirements.txt
Builtin server # init script to startup
• Gevent#入口 odoo/openerp-gevent
• Prefork#入口 odoo/openerp-server & workers <> 0
• Threaded#入口 odoo/openerp-gevent & workers = 0
WSGI application # bundle with http server like
Nginx, Apache#入口 odoo/openerp-wsgi.py
启动Odoo
Configurations• config file• options
# top securityadmin_passwd#数据库db_hostdb_portdb_userdb_password#第三方模块addons_path#多进程workers#日志相关log_levellogfilelogrotate
odoo配置
多租户模式SaaSdbfilter
Behind proxyproxy_mode
More ref. https://www.odoo.com/documentation/8.0/reference/cmdline.html
Why• Security• Performance
How• https• Static file cache• gzip
Why and how Nginx
/etc/nginx [Ubuntu]
nginx/conf [windows]
nginx.confhttp {gzip on;…}
site.conflocation / {
proxy_pass http://odoo;… }
location /longpolling {proxy_pass http://imbus;… }
location ~* /web/static/ {proxy_pass http://odoo;
… }
工具1. dstat2. pgadmin3. yslow
手段1. tune configuration2. standalone DB3. tune DB4. tune http performance, eg gzip, cache
性能优化
升级dbPython openerp-server –c odoo.conf -u modules –d db_name –stop-after-init
初始化dbPython openerp-server –c odoo.conf -i modules –d db_name –stop-after-init
PDF打印Wkhtmtltopdf > 12.1dpkg –i加入到PATH,重启服务
中文支持apt-get install ttf-wqy-zenhei ttf-wqy-microhei
Bug fix …openerp/report/render/rml2pdf/customfonts.py在TTFSearchPath[]中增加文泉译字体路径 '/usr/share/fonts/truetype/wqy',并在list_all_sysfonts()方法中,将搜索表达式 '*.[Tt][Tt][Ff]'改为 '*.[Tt][Tt][Ffc]'
其他
dbfilterrunbot
SaaS
QA