Transcript
Page 1: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

Drupal and Node.js

Ad hoc caches & Scalable Drupal powered web services

Page 2: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

Founder @

Chief Geek @

/about/me

Page 3: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 4: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

“There’s a module for that!”

Page 5: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 6: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

•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

but....

Page 8: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

“If all you have is a hammer, Everything looks like a nail”

Page 9: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

1.7 GB of Ram

Small ec2 instance

Gavri’s App

Page 10: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

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

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

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

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

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

“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

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

• 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

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

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

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

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

Swifto DEMO

Page 23: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

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

<?php

Page 25: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 26: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 27: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 28: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 29: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services
Page 30: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

Code & presentation@ github

https://github.com/linnovate/nodejsdrupal{

Page 31: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

For any help setting up an ad-hoc cacheor for any interesting funky Drupal challengewe’d be glad to help...{

[email protected]

Page 32: Lessons Learned Integrating Drupal with nodejs/mongodb Powered Web Services

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


Top Related