Production Plone HAProxy and Pound Buildout

After much trial and error, I finally got a great setup. I end up ditching Pound because of an IE6 bug. I officially have extended load balancing experience.

buildout.cfg

# ref: http://myriadicity.com/Sundry/PloneBlobs#as-we-did-with-the-standalone-instance
# production

[buildout]
parts =
poundbuild
configpound
plone
zope2
zeoserver
client1
client2
client3
client4
instance
productdistros

find-links =
http://dist.plone.org
http://download.zope.org/ppix/
http://download.zope.org/distribution/
http://effbot.org/downloads

eggs =
elementtree
Products.DocFinderTab
Products.RichDocument
Products.PloneFormGen
Products.Clouseau
collective.contentleadimage
stxnext.pdb
plone.reload
Products.RedirectionTool
Products.FCKeditor
Products.LinguaPlone<=2.4
myproj.theme
myproj.productcatalog
myproj.portlet.loginform
myproj.pas.auth
myproj.portlet.statictext
Products.CacheSetup

# Reference any eggs you are developing here, one per line
# e.g.: develop = src/my.package
develop =
src/collective.contentleadimage
src/myproj.theme
src/myproj.productcatalog
src/myproj.portlet.loginform
src/myproj.pas.auth
src/myproj.portlet.statictext

[plone]
recipe = plone.recipe.plone>=3.1.1,<3.2dev

[poundbuild]
recipe = plone.recipe.pound:build
url = http://www.apsis.ch/pound/Pound-2.4.5.tgz

[configpound]
# info: http://pypi.python.org/pypi/plone.recipe.pound/0.5.5
recipe = plone.recipe.pound:config
alive = 60
sessiontimeout = 1200000
sessioncookie = _ZopeId
sticky = on
balancers =
clients 127.0.0.1:8000 127.0.0.1:8081 127.0.0.1:8082 127.0.0.1:8083 127.0.0.1:8084

[zope2]
recipe = plone.recipe.zope2install
url = ${plone:zope2-url}

[productdistros]
recipe = plone.recipe.distros
urls =
http://www.plone4artists.org/products/plone4artistsvideo/releases/1.1/Plone4ArtistsVideo-plone3-bundle-1.1.tar.gz
http://plone.org/products/collage/releases/1.1/collage-1.1.tar.gz
http://plone.org/products/pressroom/releases/3.1/pressroom-3-1.tgz
http://plone.org/products/scrawl/releases/1.0/scrawl-1-0.tgz
http://internap.dl.sourceforge.net/sourceforge/quintagroup/qSEOptimizer-1.5.1.tar.gz

nested-packages =
Plone4ArtistsVideo-plone3-bundle-1.1
Plone4ArtistsCalendar-1.1-plone3.0-bundle

version-suffix-packages =

[site]
zeo-address = 8100
debug-http-address = 81
var = ${buildout:directory}/var
products = ${buildout:directory}/products
effective-user = zope

[zeoserver]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = ${site:zeo-address}
zeo-var = ${site:var}
effective-user = ${site:effective-user}
cache-size = 1048MB

[client1]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = True
zeo-address = ${zeoserver:zeo-address}
user = admin:changemenow
http-address = 8081
effective-user = ${site:effective-user}
debug-mode = off
verbose-security = off
zodb-cache-size = 12000
zeo-client-cache-size = 350MB
deprecation-warnings = off
session-timeout-minutes = 20
zserver-threads = 1

eggs =
${buildout:eggs}
${plone:eggs}

zcml =
myproj.theme
myproj.theme-overrides
myproj.productcatalog
plone.reload
stxnext.pdb
collective.contentleadimage
myproj.portlet.loginform
myproj.pas.auth
myproj.portlet.statictext

products =
${buildout:directory}/products
${productdistros:location}
${plone:products}

extra-paths = ${zope2:location}/lib/python

zope-conf-additional =
session-resolution-seconds 100

[client2]
recipe = collective.recipe.zope2cluster
instance-clone = client1
http-address = 8082

[client3]
recipe = collective.recipe.zope2cluster
instance-clone = client1
http-address = 8083

[client4]
recipe = collective.recipe.zope2cluster
instance-clone = client1
http-address = 8084

[instance]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:changemenow
http-address = ${site:debug-http-address}
debug-mode = on
verbose-security = on
products = ${client1:products}
eggs = ${client1:eggs}
zcml = ${client1:zcml}
extra-paths = ${client1:extra-paths}
effective-user = ${site:effective-user}


haproxy.cfg

global
maxconn 7000 # Total Max Connections
daemon
nbproc 1
log 127.0.0.1 local0
log 127.0.0.1 local1 debug

defaults
mode http
log global
option abortonclose
timeout client 30s
timeout server 1m
timeout connect 1m
timeout queue 1m
timeout http-request 3m
option httpclose # Disable Keepalive
retries 2
timeout check 30s
#option redispatch
option clitcpka
#option dontlog-normal
option httplog
#option tcplog

frontend zopecluster
bind 127.0.0.1:8000
default_backend zope
capture cookie _ZopeId len 40

backend zope
appsession _ZopeId len 33 timeout 20m
balance roundrobin
cookie _ZopeId prefix
## Define your servers to balance
server server1 127.0.0.1:8081 cookie wwwck1 weight 7
server server2 127.0.0.1:8082 cookie wwwck2 weight 7
server server3 127.0.0.1:8083 cookie wwwck3 weight 7
server server4 127.0.0.1:8084 cookie wwwck4 weight 7
#server server4 127.0.0.1:8085 cookie wwwck5 weight 7


Prod system: Plone 3, quad-core Xenon CPU, 8GB of RAM.
Mileage may vary.

Comments

Popular posts from this blog

Python SUDS with Windows Authentication (SOAP)

Text Sherlock the OpenGrok alternative (Source Code Search Engine)

How to remove, update, or replace the WKWebView inputAccessoryView