SlideShare une entreprise Scribd logo
1  sur  63
Télécharger pour lire hors ligne
Integrating
                             Erlang with PHP
                                       Alvaro Videla



                          June 2010 - IPC Spring Edition - Berlin


Wednesday, June 2, 2010
About Me

                   • Lead Developer at TheNetCircle.com
                   • Twitter: @old_sound
                   • Blog: http://obvioushints.blogspot.com/
                   • PHP Erlang Bridge Core Developer

Wednesday, June 2, 2010
What’s Erlang?




Wednesday, June 2, 2010
What’s Erlang?
                   • General Purpose Functional Language




Wednesday, June 2, 2010
What’s Erlang?
                   • General Purpose Functional Language
                   • Multi Platform




Wednesday, June 2, 2010
What’s Erlang?
                   • General Purpose Functional Language
                   • Multi Platform
                   • Invented in 1986 at Ericsson



Wednesday, June 2, 2010
What’s Erlang?
                   • General Purpose Functional Language
                   • Multi Platform
                   • Invented in 1986 at Ericsson
                   • Open Sourced in 1998


Wednesday, June 2, 2010
Products written in Erlang




Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB




Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB
                   • Ejabberd - XMPP server




Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB
                   • Ejabberd - XMPP server
                   • RabbitMQ - AMQP Messaging Server




Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB
                   • Ejabberd - XMPP server
                   • RabbitMQ - AMQP Messaging Server
                   • Riak - Decentralized Key/Value Store



Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB
                   • Ejabberd - XMPP server
                   • RabbitMQ - AMQP Messaging Server
                   • Riak - Decentralized Key/Value Store
                   • CouchDB - Document Oriented Database


Wednesday, June 2, 2010
Products written in Erlang

                   • Amazon SimpleDB
                   • Ejabberd - XMPP server
                   • RabbitMQ - AMQP Messaging Server
                   • Riak - Decentralized Key/Value Store
                   • CouchDB - Document Oriented Database
                   • Mochiweb - Lightweight HTTP Servers

Wednesday, June 2, 2010
What’s in the package?




Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance




Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance
                   • Distribution




Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance
                   • Distribution
                   • Concurrency




Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance
                   • Distribution
                   • Concurrency
                   • Code Hot Swap



Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance
                   • Distribution
                   • Concurrency
                   • Code Hot Swap
                   • Mnesia a DDBMS


Wednesday, June 2, 2010
What’s in the package?
                   • Fault Tolerance
                   • Distribution
                   • Concurrency
                   • Code Hot Swap
                   • Mnesia a DDBMS
                   • OTP Framework

Wednesday, June 2, 2010
The Language
                   • Single Assignment




Wednesday, June 2, 2010
The Language
                   • Single Assignment
                   • Controlled Side Effects




Wednesday, June 2, 2010
The Language
                   • Single Assignment
                   • Controlled Side Effects
                   • Pattern Matching



Wednesday, June 2, 2010
The Language
                   • Single Assignment
                   • Controlled Side Effects
                   • Pattern Matching
                   • Closures


Wednesday, June 2, 2010
PHP Integration

                   • PHP Erlang Bridge
                   • C Extension
                   • Converts PHP into a “cnode”


Wednesday, June 2, 2010
What can I build?




Wednesday, June 2, 2010
What can I build?
                   • Web Admins for Erlang Systems




Wednesday, June 2, 2010
What can I build?
                   • Web Admins for Erlang Systems
                   • PHP Session Storage Systems




Wednesday, June 2, 2010
What can I build?
                   • Web Admins for Erlang Systems
                   • PHP Session Storage Systems
                   • Ad hoc K/V stores



Wednesday, June 2, 2010
What can I build?
                   • Web Admins for Erlang Systems
                   • PHP Session Storage Systems
                   • Ad hoc K/V stores
                   • Run Map/Reduce Jobs in Erlang


Wednesday, June 2, 2010
What can I build?
                   • Web Admins for Erlang Systems
                   • PHP Session Storage Systems
                   • Ad hoc K/V stores
                   • Run Map/Reduce Jobs in Erlang
                   • Much more…

Wednesday, June 2, 2010
RabbitMQ Admin Console




Wednesday, June 2, 2010
RabbitMQ Admin Console




Wednesday, June 2, 2010
RabbitMQ Admin Console




Wednesday, June 2, 2010
RabbitMQ Admin Console




Wednesday, June 2, 2010
Session Storage

                   • Why?
                   • To ease session data distribution
                   • Be able to add logic to sessions
                   • Several storage backends to choose from

Wednesday, June 2, 2010
Session Storage: Bitcask

                   • Developed by Basho as a Riak backend
                   • Minimalistic API
                   • Stores data on disk
                   • Easy to Backup and Restore

                          * http://blog.basho.com/2010/04/27/hello,-bitcask/
Wednesday, June 2, 2010
Session Storage: Bitcask




                          http://github.com/videlalvaro/phpcask
Wednesday, June 2, 2010
Session Storage: Bitcask




Wednesday, June 2, 2010
Session Storage: Bitcask




Wednesday, June 2, 2010
Session Storage: Bitcask




Wednesday, June 2, 2010
Session Storage: Bitcask




Wednesday, June 2, 2010
Ad Hoc K/V Store

                   • Using Erlang Term Storage (ETS)
                   • In memory tables
                   • Adapt the API to suit your needs


Wednesday, June 2, 2010
Do I have to learn Erlang?




Wednesday, June 2, 2010
Do I have to learn Erlang?


                   • NO




Wednesday, June 2, 2010
Do I have to learn Erlang?


                   • NO
                   • Well,Yes, a little will help.



Wednesday, June 2, 2010
Do I have to learn Erlang?




                           http://learnyousomeerlang.com/
Wednesday, June 2, 2010
Installing the extension

                   • grab the code*
                   • phpize
                   • ./configure
                   • make
                   • make install
                              * http://code.google.com/p/mypeb/
Wednesday, June 2, 2010
Hello Erlang




Wednesday, June 2, 2010
Hello Erlang




Wednesday, June 2, 2010
Connecting to erlang


                   • peb_connect($host, $cookie);



Wednesday, June 2, 2010
Sending messages


                   • peb_send_by_name($node, $msg, $link);
                   • peb_send_by_pid($node, $msg, $link);


Wednesday, June 2, 2010
Encoding messages


                   • peb_vencode($format, $data);
                   • peb_encode($format, $data);


Wednesday, June 2, 2010
Encoding Examples




Wednesday, June 2, 2010
Formatting Characters
                   •      [] List

                   •      {} Tuple

                   •      ~a Atom

                   •      ~s String

                   •      ~b Binary

                   •      ~i Integer

                   •      ~d Double

                   •      ~p Pid


Wednesday, June 2, 2010
Receiving Messages


                   • peb_receive($link);



Wednesday, June 2, 2010
Decoding Messages


                   • peb_vdecode($msg);
                   • peb_decode($msg);


Wednesday, June 2, 2010
Decoding Messages

                   • String, Atom, Binary -> String
                   • Tuple, List -> Array
                   • Pid -> Resource
                   • Integer -> Integer
                   • Float -> Double

Wednesday, June 2, 2010
RPC Calls


                   •      peb_rpc($node, $module, $function, $msg);

                   •      peb_rpc_to($node, $module, $function, $msg);




Wednesday, June 2, 2010
Resources

                   •      PHP Erlang Bridge: http://code.google.com/p/mypeb/

                   •      Erlang Website: http://www.erlang.org/

                   •      Online Book: http://learnyousomeerlang.com/

                   •      Community Site http://trapexit.org/

                   •      Conferences: http://www.erlang-factory.com/




Wednesday, June 2, 2010
Questions?



Wednesday, June 2, 2010
Thanks!
                                 Alvaro Videla
                          http://twitter.com/old_sound
                              TheNetCircle.com

Wednesday, June 2, 2010

Contenu connexe

Similaire à Integrating Erlang with PHP

M.Malone Simple Geo @ Social Developers Summit
M.Malone Simple Geo @ Social Developers SummitM.Malone Simple Geo @ Social Developers Summit
M.Malone Simple Geo @ Social Developers SummitMediabistro
 
Debugging and Profiling Symfony Apps
Debugging and Profiling Symfony AppsDebugging and Profiling Symfony Apps
Debugging and Profiling Symfony AppsAlvaro Videla
 
Welcome to the Symfony2 World - FOSDEM 2013
 Welcome to the Symfony2 World - FOSDEM 2013 Welcome to the Symfony2 World - FOSDEM 2013
Welcome to the Symfony2 World - FOSDEM 2013Lukas Smith
 
Community Code: Xero
Community Code: XeroCommunity Code: Xero
Community Code: XeroSencha
 
URIplay for Open Video Conference (2009)
URIplay for Open Video Conference (2009)URIplay for Open Video Conference (2009)
URIplay for Open Video Conference (2009)Chris Jackson
 
State of the Framework Address: Recent Developments in the Metasploit Framework
State of the Framework Address: Recent Developments in the Metasploit FrameworkState of the Framework Address: Recent Developments in the Metasploit Framework
State of the Framework Address: Recent Developments in the Metasploit Frameworkegypt
 
A Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemA Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemMaher Gamal
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the TrialsSally Kleinfeldt
 
Hacking Infinispan: the new open source data grid meets NoSQL
Hacking Infinispan: the new open source data grid meets NoSQLHacking Infinispan: the new open source data grid meets NoSQL
Hacking Infinispan: the new open source data grid meets NoSQLCodemotion
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the TrialsJazkarta, Inc.
 
livedoor's opened and shared technologies
livedoor's opened and shared technologieslivedoor's opened and shared technologies
livedoor's opened and shared technologiesKoichi Taniguchi
 
Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1rit2011
 
Jeff mc cune sf 2010
Jeff mc cune sf 2010Jeff mc cune sf 2010
Jeff mc cune sf 2010Puppet
 
Building Brilliant APIs
Building Brilliant APIsBuilding Brilliant APIs
Building Brilliant APIsbencollier
 
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)Ingo Renner
 
Phone gap nikolaionken-08-06
Phone gap nikolaionken-08-06Phone gap nikolaionken-08-06
Phone gap nikolaionken-08-06Skills Matter
 

Similaire à Integrating Erlang with PHP (20)

M.Malone Simple Geo @ Social Developers Summit
M.Malone Simple Geo @ Social Developers SummitM.Malone Simple Geo @ Social Developers Summit
M.Malone Simple Geo @ Social Developers Summit
 
Debugging and Profiling Symfony Apps
Debugging and Profiling Symfony AppsDebugging and Profiling Symfony Apps
Debugging and Profiling Symfony Apps
 
Welcome to the Symfony2 World - FOSDEM 2013
 Welcome to the Symfony2 World - FOSDEM 2013 Welcome to the Symfony2 World - FOSDEM 2013
Welcome to the Symfony2 World - FOSDEM 2013
 
Community Code: Xero
Community Code: XeroCommunity Code: Xero
Community Code: Xero
 
URIplay for Open Video Conference (2009)
URIplay for Open Video Conference (2009)URIplay for Open Video Conference (2009)
URIplay for Open Video Conference (2009)
 
State of the Framework Address: Recent Developments in the Metasploit Framework
State of the Framework Address: Recent Developments in the Metasploit FrameworkState of the Framework Address: Recent Developments in the Metasploit Framework
State of the Framework Address: Recent Developments in the Metasploit Framework
 
A Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemA Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert System
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the Trials
 
Ruby Coding Dojo
Ruby Coding DojoRuby Coding Dojo
Ruby Coding Dojo
 
Hacking Infinispan: the new open source data grid meets NoSQL
Hacking Infinispan: the new open source data grid meets NoSQLHacking Infinispan: the new open source data grid meets NoSQL
Hacking Infinispan: the new open source data grid meets NoSQL
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the Trials
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
livedoor's opened and shared technologies
livedoor's opened and shared technologieslivedoor's opened and shared technologies
livedoor's opened and shared technologies
 
Http front-ends
Http front-endsHttp front-ends
Http front-ends
 
Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1
 
Jeff mc cune sf 2010
Jeff mc cune sf 2010Jeff mc cune sf 2010
Jeff mc cune sf 2010
 
ThingDOC
ThingDOCThingDOC
ThingDOC
 
Building Brilliant APIs
Building Brilliant APIsBuilding Brilliant APIs
Building Brilliant APIs
 
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)
Apache Solr for TYPO3 (@ T3CON10 Dallas, TX)
 
Phone gap nikolaionken-08-06
Phone gap nikolaionken-08-06Phone gap nikolaionken-08-06
Phone gap nikolaionken-08-06
 

Plus de Alvaro Videla

Improvements in RabbitMQ
Improvements in RabbitMQImprovements in RabbitMQ
Improvements in RabbitMQAlvaro Videla
 
Data Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring IntegrationData Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring IntegrationAlvaro Videla
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfAlvaro Videla
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHPAlvaro Videla
 
Unit Test + Functional Programming = Love
Unit Test + Functional Programming = LoveUnit Test + Functional Programming = Love
Unit Test + Functional Programming = LoveAlvaro Videla
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data IngestionAlvaro Videla
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureAlvaro Videla
 
Introduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal LabsIntroduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal LabsAlvaro Videla
 
Writing testable code
Writing testable codeWriting testable code
Writing testable codeAlvaro Videla
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot SystemAlvaro Videla
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry BootcampAlvaro Videla
 
Cloud Messaging With Cloud Foundry
Cloud Messaging With Cloud FoundryCloud Messaging With Cloud Foundry
Cloud Messaging With Cloud FoundryAlvaro Videla
 
Código Fácil De Testear
Código Fácil De TestearCódigo Fácil De Testear
Código Fácil De TestearAlvaro Videla
 
Desacoplando aplicaciones
Desacoplando aplicacionesDesacoplando aplicaciones
Desacoplando aplicacionesAlvaro Videla
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfonyAlvaro Videla
 
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory LiteScaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory LiteAlvaro Videla
 

Plus de Alvaro Videla (20)

Improvements in RabbitMQ
Improvements in RabbitMQImprovements in RabbitMQ
Improvements in RabbitMQ
 
Data Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring IntegrationData Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring Integration
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft Conf
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHP
 
Unit Test + Functional Programming = Love
Unit Test + Functional Programming = LoveUnit Test + Functional Programming = Love
Unit Test + Functional Programming = Love
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data Ingestion
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
Introduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal LabsIntroduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal Labs
 
Writing testable code
Writing testable codeWriting testable code
Writing testable code
 
RabbitMQ Hands On
RabbitMQ Hands OnRabbitMQ Hands On
RabbitMQ Hands On
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot System
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
 
Cloud Messaging With Cloud Foundry
Cloud Messaging With Cloud FoundryCloud Messaging With Cloud Foundry
Cloud Messaging With Cloud Foundry
 
Taming the rabbit
Taming the rabbitTaming the rabbit
Taming the rabbit
 
Vertx
VertxVertx
Vertx
 
Código Fácil De Testear
Código Fácil De TestearCódigo Fácil De Testear
Código Fácil De Testear
 
Desacoplando aplicaciones
Desacoplando aplicacionesDesacoplando aplicaciones
Desacoplando aplicaciones
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfony
 
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory LiteScaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
 

Integrating Erlang with PHP

  • 1. Integrating Erlang with PHP Alvaro Videla June 2010 - IPC Spring Edition - Berlin Wednesday, June 2, 2010
  • 2. About Me • Lead Developer at TheNetCircle.com • Twitter: @old_sound • Blog: http://obvioushints.blogspot.com/ • PHP Erlang Bridge Core Developer Wednesday, June 2, 2010
  • 4. What’s Erlang? • General Purpose Functional Language Wednesday, June 2, 2010
  • 5. What’s Erlang? • General Purpose Functional Language • Multi Platform Wednesday, June 2, 2010
  • 6. What’s Erlang? • General Purpose Functional Language • Multi Platform • Invented in 1986 at Ericsson Wednesday, June 2, 2010
  • 7. What’s Erlang? • General Purpose Functional Language • Multi Platform • Invented in 1986 at Ericsson • Open Sourced in 1998 Wednesday, June 2, 2010
  • 8. Products written in Erlang Wednesday, June 2, 2010
  • 9. Products written in Erlang • Amazon SimpleDB Wednesday, June 2, 2010
  • 10. Products written in Erlang • Amazon SimpleDB • Ejabberd - XMPP server Wednesday, June 2, 2010
  • 11. Products written in Erlang • Amazon SimpleDB • Ejabberd - XMPP server • RabbitMQ - AMQP Messaging Server Wednesday, June 2, 2010
  • 12. Products written in Erlang • Amazon SimpleDB • Ejabberd - XMPP server • RabbitMQ - AMQP Messaging Server • Riak - Decentralized Key/Value Store Wednesday, June 2, 2010
  • 13. Products written in Erlang • Amazon SimpleDB • Ejabberd - XMPP server • RabbitMQ - AMQP Messaging Server • Riak - Decentralized Key/Value Store • CouchDB - Document Oriented Database Wednesday, June 2, 2010
  • 14. Products written in Erlang • Amazon SimpleDB • Ejabberd - XMPP server • RabbitMQ - AMQP Messaging Server • Riak - Decentralized Key/Value Store • CouchDB - Document Oriented Database • Mochiweb - Lightweight HTTP Servers Wednesday, June 2, 2010
  • 15. What’s in the package? Wednesday, June 2, 2010
  • 16. What’s in the package? • Fault Tolerance Wednesday, June 2, 2010
  • 17. What’s in the package? • Fault Tolerance • Distribution Wednesday, June 2, 2010
  • 18. What’s in the package? • Fault Tolerance • Distribution • Concurrency Wednesday, June 2, 2010
  • 19. What’s in the package? • Fault Tolerance • Distribution • Concurrency • Code Hot Swap Wednesday, June 2, 2010
  • 20. What’s in the package? • Fault Tolerance • Distribution • Concurrency • Code Hot Swap • Mnesia a DDBMS Wednesday, June 2, 2010
  • 21. What’s in the package? • Fault Tolerance • Distribution • Concurrency • Code Hot Swap • Mnesia a DDBMS • OTP Framework Wednesday, June 2, 2010
  • 22. The Language • Single Assignment Wednesday, June 2, 2010
  • 23. The Language • Single Assignment • Controlled Side Effects Wednesday, June 2, 2010
  • 24. The Language • Single Assignment • Controlled Side Effects • Pattern Matching Wednesday, June 2, 2010
  • 25. The Language • Single Assignment • Controlled Side Effects • Pattern Matching • Closures Wednesday, June 2, 2010
  • 26. PHP Integration • PHP Erlang Bridge • C Extension • Converts PHP into a “cnode” Wednesday, June 2, 2010
  • 27. What can I build? Wednesday, June 2, 2010
  • 28. What can I build? • Web Admins for Erlang Systems Wednesday, June 2, 2010
  • 29. What can I build? • Web Admins for Erlang Systems • PHP Session Storage Systems Wednesday, June 2, 2010
  • 30. What can I build? • Web Admins for Erlang Systems • PHP Session Storage Systems • Ad hoc K/V stores Wednesday, June 2, 2010
  • 31. What can I build? • Web Admins for Erlang Systems • PHP Session Storage Systems • Ad hoc K/V stores • Run Map/Reduce Jobs in Erlang Wednesday, June 2, 2010
  • 32. What can I build? • Web Admins for Erlang Systems • PHP Session Storage Systems • Ad hoc K/V stores • Run Map/Reduce Jobs in Erlang • Much more… Wednesday, June 2, 2010
  • 37. Session Storage • Why? • To ease session data distribution • Be able to add logic to sessions • Several storage backends to choose from Wednesday, June 2, 2010
  • 38. Session Storage: Bitcask • Developed by Basho as a Riak backend • Minimalistic API • Stores data on disk • Easy to Backup and Restore * http://blog.basho.com/2010/04/27/hello,-bitcask/ Wednesday, June 2, 2010
  • 39. Session Storage: Bitcask http://github.com/videlalvaro/phpcask Wednesday, June 2, 2010
  • 44. Ad Hoc K/V Store • Using Erlang Term Storage (ETS) • In memory tables • Adapt the API to suit your needs Wednesday, June 2, 2010
  • 45. Do I have to learn Erlang? Wednesday, June 2, 2010
  • 46. Do I have to learn Erlang? • NO Wednesday, June 2, 2010
  • 47. Do I have to learn Erlang? • NO • Well,Yes, a little will help. Wednesday, June 2, 2010
  • 48. Do I have to learn Erlang? http://learnyousomeerlang.com/ Wednesday, June 2, 2010
  • 49. Installing the extension • grab the code* • phpize • ./configure • make • make install * http://code.google.com/p/mypeb/ Wednesday, June 2, 2010
  • 52. Connecting to erlang • peb_connect($host, $cookie); Wednesday, June 2, 2010
  • 53. Sending messages • peb_send_by_name($node, $msg, $link); • peb_send_by_pid($node, $msg, $link); Wednesday, June 2, 2010
  • 54. Encoding messages • peb_vencode($format, $data); • peb_encode($format, $data); Wednesday, June 2, 2010
  • 56. Formatting Characters • [] List • {} Tuple • ~a Atom • ~s String • ~b Binary • ~i Integer • ~d Double • ~p Pid Wednesday, June 2, 2010
  • 57. Receiving Messages • peb_receive($link); Wednesday, June 2, 2010
  • 58. Decoding Messages • peb_vdecode($msg); • peb_decode($msg); Wednesday, June 2, 2010
  • 59. Decoding Messages • String, Atom, Binary -> String • Tuple, List -> Array • Pid -> Resource • Integer -> Integer • Float -> Double Wednesday, June 2, 2010
  • 60. RPC Calls • peb_rpc($node, $module, $function, $msg); • peb_rpc_to($node, $module, $function, $msg); Wednesday, June 2, 2010
  • 61. Resources • PHP Erlang Bridge: http://code.google.com/p/mypeb/ • Erlang Website: http://www.erlang.org/ • Online Book: http://learnyousomeerlang.com/ • Community Site http://trapexit.org/ • Conferences: http://www.erlang-factory.com/ Wednesday, June 2, 2010
  • 63. Thanks! Alvaro Videla http://twitter.com/old_sound TheNetCircle.com Wednesday, June 2, 2010