lessons learned integrating drupal with nodejs/mongodb powered web services

Post on 05-Dec-2014

10.415 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Drupal and Node.js

Ad hoc caches & Scalable Drupal powered web services

Founder @

Chief Geek @

/about/me

“There’s a module for that!”

•Multiple response format (REST, XMLRPC,JSON, JSON-RPC, SOAP, AMF)

•Pluggeble access control•Amazing integration with available

modules(Views, System, node, taxonomy, authentication ... )

but....

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

1.7 GB of Ram

Small ec2 instance

Gavri’s App

1500 / 30 = 50 Concurrent

All Memory - 1700MBFree Memory - 1500MB

Avg Drupal process size ~ 30MB

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.”

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.”

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)

1500000 / 100 = 15000 Concurrent

All Memory - 1700MBFree Memory - 150000k

example node.js process size ~ 100k

“But If we improve concurrency

by 500X won’t that just - Jam Mysql even more?”

Introducing MongoDB• Document oriented storage• Full index support (+geo)• Replication and High Availability• Querying • Map Reduce

• speak Javascript• “Understand” json documents• Are Very fast• are very popular and together are a path well traveled (relatively speaking)

Both:+

When To use this pattern? • JSON API’s• Single Page Apps• Shelling out to unix tools• Streaming Data• Soft Realtime Applications

When NOT to use this pattern? • CPU Heavy tasks• Simple CRUD / HTML apps• Just for the BuzzWord compliance.

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

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

Swifto DEMO

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

<?php

Code & presentation@ github

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

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

contact@linnovate.net

For more information visit: http://www.acquia.com

eMail: sales@acquia.com orCall: 888.9.ACQUIA

Follow us: @acquiaLior: contact@linnovate.net

Kieran Lal – kieran@acquia.com

Questions

Today’s webinar recording will be posted to:http://acquia.com/resources/recorded_webinars

top related