SlideShare a Scribd company logo
Making ZOPE faster
●   Without Squid
●   Without CacheFu
●   Without Varnish
The Problem
                (my problem)
●   The website uses LinguaPlone
    (what is that?!?)
    ... It uses Cookies for
    language selection

●   Aaaaagh !
Apache + Dynamic Rewrite Map
RewriteMap rpx prg:/home/admin/rpx.py
RewriteRule ^(.*)$ ${rpx:%{HTTP_COOKIE}<>$1<>%{QUERY_STRING}} [P,L]

RewriteMap rpx prg:/home/admin/rpx.py

RewriteRule ^(.*)$
   ${rpx:%{HTTP_COOKIE}
   <>$1
   <>%{QUERY_STRING}}
   [P,L]
The Dynamic Map Script

#!/usr/bin/python -u
import sys, os, time, urllib2, urllib, re

cacheroot = "/var/www/cache"
zoperoot =
  "http://slowzope:10000/VirtualHostBas
  e/http/fastrewriter:80/VirtualHostRoot"
logpath = "/home/admin/rpx.log"
The Real Dynamic Map Script
cookies, uri, qstring = request.split('<>')
lang = re.findall('I18N_LANGUAGE="([A_Za-z]+)"', cookies)
lang = lang and lang[0] or ''
locuri = uri + "/<>" + lang
if qstring:
    log("PASS %sn"%locuri)
    sys.stdout.write(zoperoot+uri+"n")
elif os.path.isfile(cacheroot + locuri):
    log("HIT %sn"%locuri)
    sys.stdout.write("http://faststatic/cache/%sn"%locuri)
else:
    log("MISS %sn"%locuri)
    sys.stdout.write(zoperoot+uri+"n")
The Cache Feeder
if line.startswith("MISS "):
     filepath = line[5:].strip()
     uri, extra = filepath.split("/<>")
     req = urllib2.Request(zoperoot+urllib.quote(uri),
              None, {'Cookie': 'I18N_LANGUAGE="%s"'%extra})
     o = urllib2.urlopen(req)
     data = o.read()
     datadir = cacheroot + "/" + uri
     if not os.path.isdir(datadir):os.makedirs(datadir)
     f = open(datadir + "/.htaccess", "w")
     f.write("ForceType %sn"%o.info().type)
     f.close()
     f = open(cacheroot + "/" + filepath,"w")
     f.write(data)
     f.close()
     log("FETCH %s <> %sn"%(filepath,extra))
The Cache Itself
admin@cache:~/cache$ find -type f | head
./services/locations-and-contacts/.htaccess
./services/locations-and-contacts/<>
./services/locations-and-contacts/<>fr
./services/locations-and-contacts/<>de
./capabilities-1/navigation-services-1/.htaccess
./capabilities-1/navigation-services-1/<>
./services/index_html/rss.gif/.htaccess
./services/index_html/rss.gif/<>fr
I swear the code is simple !

admin@cache:~$ wc -l rpx.py
74 rpx.py
Results




Watch to the lovely pictures !
In the unlikely event you want to know
      more about this really dirty hack ...
●   Jérôme Petazzoni
    <jerome.petazzoni@pilotsystems.net>

More Related Content

What's hot

Raspberry pi Part 4
Raspberry pi Part 4Raspberry pi Part 4
Raspberry pi Part 4
Techvilla
 
Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)
Dominic Cleal
 
File::CleanupTask
File::CleanupTaskFile::CleanupTask
File::CleanupTask
Alex Balhatchet
 
Cpsh sh
Cpsh shCpsh sh
Cpsh sh
Ben Pope
 
Profiling with Xhprof
Profiling with XhprofProfiling with Xhprof
Profiling with Xhprof
Tim Massey
 
Find and zip files
Find and zip filesFind and zip files
Find and zip files
Muqthiyar Pasha
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
aaronheckmann
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
Tse-Ching Ho
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
Chhom Karath
 
App-o-Lockalypse now!
App-o-Lockalypse now!App-o-Lockalypse now!
App-o-Lockalypse now!
Oddvar Moe
 
Gaelyk
GaelykGaelyk
working with files
working with filesworking with files
working with files
SangeethaSasi1
 
Web Scrapping with Python
Web Scrapping with PythonWeb Scrapping with Python
Web Scrapping with Python
Miguel Miranda de Mattos
 
S3 & Glacier - The only backup solution you'll ever need
S3 & Glacier - The only backup solution you'll ever needS3 & Glacier - The only backup solution you'll ever need
S3 & Glacier - The only backup solution you'll ever need
Matthew Boeckman
 
Abusing Erlang compilation pipeline for Fun and Profit
Abusing Erlang compilation pipeline for Fun and ProfitAbusing Erlang compilation pipeline for Fun and Profit
Abusing Erlang compilation pipeline for Fun and Profit
Wojciech Gawroński
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSLadislav Prskavec
 

What's hot (19)

Raspberry pi Part 4
Raspberry pi Part 4Raspberry pi Part 4
Raspberry pi Part 4
 
serverstats
serverstatsserverstats
serverstats
 
Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)
 
File::CleanupTask
File::CleanupTaskFile::CleanupTask
File::CleanupTask
 
Cpsh sh
Cpsh shCpsh sh
Cpsh sh
 
Profiling with Xhprof
Profiling with XhprofProfiling with Xhprof
Profiling with Xhprof
 
Find and zip files
Find and zip filesFind and zip files
Find and zip files
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
Compile kernel
Compile kernelCompile kernel
Compile kernel
 
Bash Scripting
Bash ScriptingBash Scripting
Bash Scripting
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
 
App-o-Lockalypse now!
App-o-Lockalypse now!App-o-Lockalypse now!
App-o-Lockalypse now!
 
Gaelyk
GaelykGaelyk
Gaelyk
 
working with files
working with filesworking with files
working with files
 
Web Scrapping with Python
Web Scrapping with PythonWeb Scrapping with Python
Web Scrapping with Python
 
S3 & Glacier - The only backup solution you'll ever need
S3 & Glacier - The only backup solution you'll ever needS3 & Glacier - The only backup solution you'll ever need
S3 & Glacier - The only backup solution you'll ever need
 
Abusing Erlang compilation pipeline for Fun and Profit
Abusing Erlang compilation pipeline for Fun and ProfitAbusing Erlang compilation pipeline for Fun and Profit
Abusing Erlang compilation pipeline for Fun and Profit
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
 

Viewers also liked

Neoppod, discloses first open source transactional NoSQL Object database for ...
Neoppod, discloses first open source transactional NoSQL Object database for ...Neoppod, discloses first open source transactional NoSQL Object database for ...
Neoppod, discloses first open source transactional NoSQL Object database for ...
Paris, France
 
DoSomething + Mobile
DoSomething + MobileDoSomething + Mobile
DoSomething + Mobile
501 Tech NYC
 
Deutsche EuroShop "Acquisition of A10 Center Wildau"
Deutsche EuroShop "Acquisition of A10 Center Wildau"Deutsche EuroShop "Acquisition of A10 Center Wildau"
Deutsche EuroShop "Acquisition of A10 Center Wildau"Deutsche EuroShop AG
 
How Animals Move - Chapter 30
How Animals Move - Chapter 30How Animals Move - Chapter 30
How Animals Move - Chapter 30Wesley McCammon
 
Transformation digitale
Transformation digitaleTransformation digitale
Transformation digitale
Paris, France
 

Viewers also liked (6)

Neoppod, discloses first open source transactional NoSQL Object database for ...
Neoppod, discloses first open source transactional NoSQL Object database for ...Neoppod, discloses first open source transactional NoSQL Object database for ...
Neoppod, discloses first open source transactional NoSQL Object database for ...
 
DoSomething + Mobile
DoSomething + MobileDoSomething + Mobile
DoSomething + Mobile
 
Deutsche EuroShop "Acquisition of A10 Center Wildau"
Deutsche EuroShop "Acquisition of A10 Center Wildau"Deutsche EuroShop "Acquisition of A10 Center Wildau"
Deutsche EuroShop "Acquisition of A10 Center Wildau"
 
Computer Beginners
Computer BeginnersComputer Beginners
Computer Beginners
 
How Animals Move - Chapter 30
How Animals Move - Chapter 30How Animals Move - Chapter 30
How Animals Move - Chapter 30
 
Transformation digitale
Transformation digitaleTransformation digitale
Transformation digitale
 

Similar to Plone Conference 2008 Lightning Talk Static Zope Rpx

ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
Giovanni Bechis
 
On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappersPositive Hack Days
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebookguoqing75
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统yiditushe
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
Ian Barber
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
Cheng-Yi Yu
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
Ian Barber
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
Võ Duy Tuấn
 
Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
Federico Damián Lozada Mosto
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens Аuer
Yandex
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
Alona Mekhovova
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
Elizabeth Smith
 
GDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google CloudGDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google Cloud
Bhavik Shah
 
AWS Hadoop and PIG and overview
AWS Hadoop and PIG and overviewAWS Hadoop and PIG and overview
AWS Hadoop and PIG and overview
Dan Morrill
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
Sandro Zaccarini
 
PHP CLI: A Cinderella Story
PHP CLI: A Cinderella StoryPHP CLI: A Cinderella Story
PHP CLI: A Cinderella Story
Mike Lively
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
Server Density
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
julien pauli
 
Twas the night before Malware...
Twas the night before Malware...Twas the night before Malware...
Twas the night before Malware...
DoktorMandrake
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
Puppet
 

Similar to Plone Conference 2008 Lightning Talk Static Zope Rpx (20)

ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappers
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
 
Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
 
RESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens АuerRESTing with the new Yandex.Disk API, Clemens Аuer
RESTing with the new Yandex.Disk API, Clemens Аuer
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
GDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google CloudGDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google Cloud
 
AWS Hadoop and PIG and overview
AWS Hadoop and PIG and overviewAWS Hadoop and PIG and overview
AWS Hadoop and PIG and overview
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
PHP CLI: A Cinderella Story
PHP CLI: A Cinderella StoryPHP CLI: A Cinderella Story
PHP CLI: A Cinderella Story
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
Twas the night before Malware...
Twas the night before Malware...Twas the night before Malware...
Twas the night before Malware...
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 

More from Paris, France

Django Hacking : Comment dresser les serpents guitaristes
Django Hacking : Comment dresser les serpents guitaristesDjango Hacking : Comment dresser les serpents guitaristes
Django Hacking : Comment dresser les serpents guitaristesParis, France
 
SeSQL : un moteur de recherche en Python et PostgreSQL
SeSQL : un moteur de recherche en Python et PostgreSQLSeSQL : un moteur de recherche en Python et PostgreSQL
SeSQL : un moteur de recherche en Python et PostgreSQLParis, France
 
Neopod: une base de données objet distribuée
Neopod: une base de données objet distribuéeNeopod: une base de données objet distribuée
Neopod: une base de données objet distribuéeParis, France
 
Conférence Sesql - DjangoCong 2011
Conférence Sesql - DjangoCong 2011Conférence Sesql - DjangoCong 2011
Conférence Sesql - DjangoCong 2011
Paris, France
 
API Cockpit : faites communiquer vos applications web
API Cockpit : faites communiquer vos applications webAPI Cockpit : faites communiquer vos applications web
API Cockpit : faites communiquer vos applications web
Paris, France
 
Indexation d'une base documentaire pour Liberation
Indexation d'une base documentaire pour LiberationIndexation d'une base documentaire pour Liberation
Indexation d'une base documentaire pour Liberation
Paris, France
 
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
Paris, France
 
Cockpit, gestion de contacts et d'emailing
Cockpit, gestion de contacts et d'emailingCockpit, gestion de contacts et d'emailing
Cockpit, gestion de contacts et d'emailing
Paris, France
 
Plone, du site web à la gestion documentaire
Plone, du site web à la gestion documentairePlone, du site web à la gestion documentaire
Plone, du site web à la gestion documentaire
Paris, France
 
Les critères de choix d'un intranet
Les critères de choix d'un intranetLes critères de choix d'un intranet
Les critères de choix d'un intranet
Paris, France
 
Virtualisation Cloud Computing Saas Open Source
Virtualisation Cloud Computing Saas Open SourceVirtualisation Cloud Computing Saas Open Source
Virtualisation Cloud Computing Saas Open Source
Paris, France
 
Partenariat Exo Platform/Pilot Systems
Partenariat Exo Platform/Pilot SystemsPartenariat Exo Platform/Pilot Systems
Partenariat Exo Platform/Pilot Systems
Paris, France
 
Open World Forum 2009 Synthesis
Open World Forum 2009 SynthesisOpen World Forum 2009 Synthesis
Open World Forum 2009 Synthesis
Paris, France
 
Open World Forum 2009 Presentation
Open World Forum 2009 PresentationOpen World Forum 2009 Presentation
Open World Forum 2009 Presentation
Paris, France
 
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
Paris, France
 
Deploiement de Plone et Deliverance avec Ubuntu VM Builder
Deploiement de Plone et Deliverance avec Ubuntu VM BuilderDeploiement de Plone et Deliverance avec Ubuntu VM Builder
Deploiement de Plone et Deliverance avec Ubuntu VM Builder
Paris, France
 
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
Paris, France
 
Construire un module enfichable (pluggable) et dynamique pour Plone
Construire un module enfichable (pluggable) et dynamique pour PloneConstruire un module enfichable (pluggable) et dynamique pour Plone
Construire un module enfichable (pluggable) et dynamique pour Plone
Paris, France
 
La virtualisation dans le Datacenter
La virtualisation dans le DatacenterLa virtualisation dans le Datacenter
La virtualisation dans le Datacenter
Paris, France
 
Guide pratique des logiciels libres dans les administrations
Guide pratique des logiciels libres dans les administrationsGuide pratique des logiciels libres dans les administrations
Guide pratique des logiciels libres dans les administrations
Paris, France
 

More from Paris, France (20)

Django Hacking : Comment dresser les serpents guitaristes
Django Hacking : Comment dresser les serpents guitaristesDjango Hacking : Comment dresser les serpents guitaristes
Django Hacking : Comment dresser les serpents guitaristes
 
SeSQL : un moteur de recherche en Python et PostgreSQL
SeSQL : un moteur de recherche en Python et PostgreSQLSeSQL : un moteur de recherche en Python et PostgreSQL
SeSQL : un moteur de recherche en Python et PostgreSQL
 
Neopod: une base de données objet distribuée
Neopod: une base de données objet distribuéeNeopod: une base de données objet distribuée
Neopod: une base de données objet distribuée
 
Conférence Sesql - DjangoCong 2011
Conférence Sesql - DjangoCong 2011Conférence Sesql - DjangoCong 2011
Conférence Sesql - DjangoCong 2011
 
API Cockpit : faites communiquer vos applications web
API Cockpit : faites communiquer vos applications webAPI Cockpit : faites communiquer vos applications web
API Cockpit : faites communiquer vos applications web
 
Indexation d'une base documentaire pour Liberation
Indexation d'une base documentaire pour LiberationIndexation d'une base documentaire pour Liberation
Indexation d'une base documentaire pour Liberation
 
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
Systematic/NEOPPOD dévoilent la première base de données objets NoSQL Open So...
 
Cockpit, gestion de contacts et d'emailing
Cockpit, gestion de contacts et d'emailingCockpit, gestion de contacts et d'emailing
Cockpit, gestion de contacts et d'emailing
 
Plone, du site web à la gestion documentaire
Plone, du site web à la gestion documentairePlone, du site web à la gestion documentaire
Plone, du site web à la gestion documentaire
 
Les critères de choix d'un intranet
Les critères de choix d'un intranetLes critères de choix d'un intranet
Les critères de choix d'un intranet
 
Virtualisation Cloud Computing Saas Open Source
Virtualisation Cloud Computing Saas Open SourceVirtualisation Cloud Computing Saas Open Source
Virtualisation Cloud Computing Saas Open Source
 
Partenariat Exo Platform/Pilot Systems
Partenariat Exo Platform/Pilot SystemsPartenariat Exo Platform/Pilot Systems
Partenariat Exo Platform/Pilot Systems
 
Open World Forum 2009 Synthesis
Open World Forum 2009 SynthesisOpen World Forum 2009 Synthesis
Open World Forum 2009 Synthesis
 
Open World Forum 2009 Presentation
Open World Forum 2009 PresentationOpen World Forum 2009 Presentation
Open World Forum 2009 Presentation
 
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
Deliverance, la puissance de la gestion de contenu Plone appliquee aux themes...
 
Deploiement de Plone et Deliverance avec Ubuntu VM Builder
Deploiement de Plone et Deliverance avec Ubuntu VM BuilderDeploiement de Plone et Deliverance avec Ubuntu VM Builder
Deploiement de Plone et Deliverance avec Ubuntu VM Builder
 
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
Deliverance, la puissance de la gestion de contenu Plone appliquée aux thèmes...
 
Construire un module enfichable (pluggable) et dynamique pour Plone
Construire un module enfichable (pluggable) et dynamique pour PloneConstruire un module enfichable (pluggable) et dynamique pour Plone
Construire un module enfichable (pluggable) et dynamique pour Plone
 
La virtualisation dans le Datacenter
La virtualisation dans le DatacenterLa virtualisation dans le Datacenter
La virtualisation dans le Datacenter
 
Guide pratique des logiciels libres dans les administrations
Guide pratique des logiciels libres dans les administrationsGuide pratique des logiciels libres dans les administrations
Guide pratique des logiciels libres dans les administrations
 

Recently uploaded

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

Plone Conference 2008 Lightning Talk Static Zope Rpx

  • 1. Making ZOPE faster ● Without Squid ● Without CacheFu ● Without Varnish
  • 2. The Problem (my problem) ● The website uses LinguaPlone (what is that?!?) ... It uses Cookies for language selection ● Aaaaagh !
  • 3. Apache + Dynamic Rewrite Map RewriteMap rpx prg:/home/admin/rpx.py RewriteRule ^(.*)$ ${rpx:%{HTTP_COOKIE}<>$1<>%{QUERY_STRING}} [P,L] RewriteMap rpx prg:/home/admin/rpx.py RewriteRule ^(.*)$ ${rpx:%{HTTP_COOKIE} <>$1 <>%{QUERY_STRING}} [P,L]
  • 4. The Dynamic Map Script #!/usr/bin/python -u import sys, os, time, urllib2, urllib, re cacheroot = "/var/www/cache" zoperoot = "http://slowzope:10000/VirtualHostBas e/http/fastrewriter:80/VirtualHostRoot" logpath = "/home/admin/rpx.log"
  • 5. The Real Dynamic Map Script cookies, uri, qstring = request.split('<>') lang = re.findall('I18N_LANGUAGE="([A_Za-z]+)"', cookies) lang = lang and lang[0] or '' locuri = uri + "/<>" + lang if qstring: log("PASS %sn"%locuri) sys.stdout.write(zoperoot+uri+"n") elif os.path.isfile(cacheroot + locuri): log("HIT %sn"%locuri) sys.stdout.write("http://faststatic/cache/%sn"%locuri) else: log("MISS %sn"%locuri) sys.stdout.write(zoperoot+uri+"n")
  • 6. The Cache Feeder if line.startswith("MISS "): filepath = line[5:].strip() uri, extra = filepath.split("/<>") req = urllib2.Request(zoperoot+urllib.quote(uri), None, {'Cookie': 'I18N_LANGUAGE="%s"'%extra}) o = urllib2.urlopen(req) data = o.read() datadir = cacheroot + "/" + uri if not os.path.isdir(datadir):os.makedirs(datadir) f = open(datadir + "/.htaccess", "w") f.write("ForceType %sn"%o.info().type) f.close() f = open(cacheroot + "/" + filepath,"w") f.write(data) f.close() log("FETCH %s <> %sn"%(filepath,extra))
  • 7. The Cache Itself admin@cache:~/cache$ find -type f | head ./services/locations-and-contacts/.htaccess ./services/locations-and-contacts/<> ./services/locations-and-contacts/<>fr ./services/locations-and-contacts/<>de ./capabilities-1/navigation-services-1/.htaccess ./capabilities-1/navigation-services-1/<> ./services/index_html/rss.gif/.htaccess ./services/index_html/rss.gif/<>fr
  • 8. I swear the code is simple ! admin@cache:~$ wc -l rpx.py 74 rpx.py
  • 9. Results Watch to the lovely pictures !
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. In the unlikely event you want to know more about this really dirty hack ... ● Jérôme Petazzoni <jerome.petazzoni@pilotsystems.net>