www.texperts.com intellectual scalability solving a large problem with multiple cooperating rails...
TRANSCRIPT
![Page 1: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/1.jpg)
www.texperts.com
Intellectual ScalabilitySolving a Large Problem with Multiple Cooperating Rails Apps
Frederick Cheung, Chief Wizard, TexpertsPaul Butcher, CTO, Texperts
![Page 2: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/2.jpg)
www.texperts.com
What is the least scalable element of your project?
![Page 3: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/3.jpg)
www.texperts.com
![Page 4: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/4.jpg)
www.texperts.com
Our Problem
+----------------------+-------+-------+---------+---------+-----+-------+| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |+----------------------+-------+-------+---------+---------+-----+-------+| Controllers | 7435 | 6169 | 116 | 687 | 5 | 6 || Helpers | 1726 | 1504 | 0 | 167 | 0 | 7 || Models | 18030 | 14598 | 359 | 1428 | 3 | 8 || Libraries | 4357 | 2934 | 38 | 227 | 5 | 10 || APIs | 91 | 74 | 11 | 0 | 0 | 0 || Components | 0 | 0 | 0 | 0 | 0 | 0 || Functional tests | 12808 | 10286 | 178 | 1177 | 6 | 6 || Unit tests | 24099 | 18762 | 237 | 1514 | 6 | 10 |+----------------------+-------+-------+---------+---------+-----+-------+| Total | 68546 | 54327 | 939 | 5200 | 5 | 8 |+----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 25279 Test LOC: 29048 Code to Test Ratio: 1:1.1
![Page 5: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/5.jpg)
www.texperts.com
Our Problem
![Page 6: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/6.jpg)
www.texperts.com
The Solution
• Multiple Apps!
… but …• How do they talk to each other?• How do they share code?• How do we roll them out?• How do we test them?
… and most importantly …• How do we make it all appear seamless?
![Page 7: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/7.jpg)
www.texperts.com
Headlines
• Apps developed and rolled out in “lock-step”• Simple directory structure
• All apps under a single root directory• Code sharing through shared plugins*
• Hacked version of Capistrano• All applications rolled out simultaneously
• Cross-application testing with Selenium
* http://www.texperts.com/2007/06/21/on-sharing-code-between-rails-apps/
![Page 8: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/8.jpg)
www.texperts.com
Inter-App
Communication
• Each app has its own database• No communication via the database• Apps could run on separate machines
• Hybrid server- and client-side communication• Server-side communication via RESTful APIs• Client-side communication via UI framework
![Page 9: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/9.jpg)
www.texperts.com
UI Framework
• Integrated UI✘Multiple URLs✘Multiple logins✘Multiple windows✔Appears to be a single app
• Problems• Efficient client-side communication• Single Origin Policy
![Page 10: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/10.jpg)
www.texperts.com
Architecture
foo.example.com
bar.example.com
baz.example.com
app.example.com/foo
app.example.com/bar
app.example.com/baz
Load Balancer/Rewriter
![Page 11: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/11.jpg)
www.texperts.com
Apache Rewrite Rules
<VirtualHost *:80> ServerName app.example.com
...
RewriteEngine On RewriteRule ^/foo/(.*)$ http://foo.example.com/$1 [P,QSA,L] RewriteRule ^/bar/(.*)$ http://bar.example.com/$1 [P,QSA,L] RewriteRule ^/baz/(.*)$ http://baz.example.com/$1 [P,QSA,L]</VirtualHost>
![Page 12: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/12.jpg)
www.texperts.com
UI Framework
• Single “portal” application• Applications implement “widgets”• Widgets loaded via AJAX
Portal
App1 App1
App2
App3
App2
![Page 13: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/13.jpg)
www.texperts.com
Demonstration
![Page 14: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/14.jpg)
www.texperts.com
Status
• In production since June 2008• 5 applications integrated (and counting)• Texperts report:
✔Better UI responsiveness✔Higher productivity✘Doesn’t work well on high-latency connections
![Page 15: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/15.jpg)
www.texperts.com
Questions
![Page 16: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/16.jpg)
www.texperts.com
Support Slides
![Page 17: Www.texperts.com Intellectual Scalability Solving a Large Problem with Multiple Cooperating Rails Apps Frederick Cheung, Chief Wizard, Texperts Paul Butcher,](https://reader030.vdocuments.mx/reader030/viewer/2022032415/56649f0c5503460f94c1fb92/html5/thumbnails/17.jpg)
www.texperts.com
Why IFRAMEs Don’t
Work
• Each IFRAME is its own independent HTML document• Difficult to resize• Difficult to communicate between• Difficult to style consistently
• Makes Darren (our web-standards guy) cry