Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
-
Upload
acquia -
Category
Technology
-
view
10.416 -
download
4
description
Transcript of Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
![Page 1: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/1.jpg)
Drupal and Node.js
Ad hoc caches & Scalable Drupal powered web services
![Page 2: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/2.jpg)
Founder @
Chief Geek @
/about/me
![Page 3: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/3.jpg)
![Page 4: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/4.jpg)
“There’s a module for that!”
![Page 5: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/5.jpg)
![Page 6: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/6.jpg)
•Multiple response format (REST, XMLRPC,JSON, JSON-RPC, SOAP, AMF)
•Pluggeble access control•Amazing integration with available
modules(Views, System, node, taxonomy, authentication ... )
![Page 7: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/7.jpg)
but....
![Page 8: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/8.jpg)
“If all you have is a hammer, Everything looks like a nail”
![Page 9: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/9.jpg)
1.7 GB of Ram
Small ec2 instance
Gavri’s App
![Page 10: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/10.jpg)
1500 / 30 = 50 Concurrent
All Memory - 1700MBFree Memory - 1500MB
Avg Drupal process size ~ 30MB
![Page 11: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/11.jpg)
Introducing Node.js“Node is a server-side JavaScript interpreter that changes the notion of how a server should work. Its goal is to enable a programmer to build highly-scalable applications and write code that handles tens of thousands of simultaneous connections on one, and only one, physical machine.”
![Page 12: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/12.jpg)
Introducing Node.js
“Node is a server-side JavaScript interpreter that changes the notion of how a server should work. Its goal is to enable a programmer to build highly-scalable applications and write code that handles tens of thousands of simultaneous connections on one, and only one, physical machine.”
![Page 13: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/13.jpg)
Introducing Node.js• Built on the V8 engine (chrome’s very fast browser engine).• Can handle thousands of concurrent connections with minimal overhead.• Ability to share code between server and client• Vibrant Community• Great package management (npm)
![Page 14: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/14.jpg)
1500000 / 100 = 15000 Concurrent
All Memory - 1700MBFree Memory - 150000k
example node.js process size ~ 100k
![Page 15: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/15.jpg)
“But If we improve concurrency
by 500X won’t that just - Jam Mysql even more?”
![Page 16: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/16.jpg)
Introducing MongoDB• Document oriented storage• Full index support (+geo)• Replication and High Availability• Querying • Map Reduce
![Page 17: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/17.jpg)
• speak Javascript• “Understand” json documents• Are Very fast• are very popular and together are a path well traveled (relatively speaking)
Both:+
![Page 18: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/18.jpg)
When To use this pattern? • JSON API’s• Single Page Apps• Shelling out to unix tools• Streaming Data• Soft Realtime Applications
![Page 19: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/19.jpg)
When NOT to use this pattern? • CPU Heavy tasks• Simple CRUD / HTML apps• Just for the BuzzWord compliance.
![Page 20: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/20.jpg)
Let’s look in depth in to one of these usecases...
• JSON API’s• Single Page Apps• Shelling out to unix tools• Streaming Data• Soft Realtime Applications
![Page 21: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/21.jpg)
1. Node based API Server serves mobile/widgets etc..
2. MongoDB database stores state.
3. Services module dealswith interacting with Drupal
4. Drupal is the front for content creation
![Page 22: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/22.jpg)
Swifto DEMO
![Page 23: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/23.jpg)
1. Node based API Server serves mobile/widgets etc..
2. MongoDB database stores state.
3. Services module dealswith interacting with Drupal
4. Drupal is the front for content creation
![Page 24: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/24.jpg)
<?php
![Page 25: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/25.jpg)
![Page 26: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/26.jpg)
![Page 27: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/27.jpg)
![Page 28: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/28.jpg)
![Page 29: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/29.jpg)
![Page 30: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/30.jpg)
Code & presentation@ github
https://github.com/linnovate/nodejsdrupal{
![Page 31: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/31.jpg)
For any help setting up an ad-hoc cacheor for any interesting funky Drupal challengewe’d be glad to help...{
![Page 32: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services](https://reader036.fdocuments.us/reader036/viewer/2022062615/5484bc7ab4af9f8c0d8b4d0b/html5/thumbnails/32.jpg)
For more information visit: http://www.acquia.com
eMail: [email protected] orCall: 888.9.ACQUIA
Follow us: @acquiaLior: [email protected]
Kieran Lal – [email protected]
Questions
Today’s webinar recording will be posted to:http://acquia.com/resources/recorded_webinars