72
Event-Driven Architectures Benjamin Eberlei direkt effekt GmbH IPC 09, Karlsruhe Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 1 / 42

Towards the Cloud: Event-driven Architectures in PHP

Embed Size (px)

DESCRIPTION

Are you fed up with all the interdependencies in your applications? Want to be able to scale your business application across multiple servers without hassle? Event-driven architectures to the rescue! In this talk I show how to divide your tasks into small, perfectly scalable parts, empowering you to either scale with your own servers or benefit from cloud computing technologies.

Citation preview

Page 1: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

Benjamin Eberlei

direkt effekt GmbH

IPC 09, Karlsruhe

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 1 / 42

Page 2: Towards the Cloud: Event-driven Architectures in PHP

About Me

I Benjamin Eberlei

I direkt effekt GmBH

(digital marketing)

I Open Source contributor

(Zend Framework and Doctrine 2)

I Twitter @beberlei

I Blog: www.whitewashing.de

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 2 / 42

Page 3: Towards the Cloud: Event-driven Architectures in PHP

First: A typical monolithic PHPapplication

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 3 / 42

Page 4: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 5: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 6: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 7: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 8: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 9: Towards the Cloud: Event-driven Architectures in PHP

I Fowler, PoEAA: “Transaction Scripts”

I Retrieve Required Data from Database

I Process Data

I Make changes persistent

I Show the user some output

I Repeat.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 4 / 42

Page 10: Towards the Cloud: Event-driven Architectures in PHP

A Simple Application: PhotoCommunity

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 5 / 42

Page 11: Towards the Cloud: Event-driven Architectures in PHP

Photo

class Photo{

public $id;public $name;public $tags = array ();public $user = null;public $metadata = array ();public $originalFile = "";public $thumbnailFile = "";public $created = 0;

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 6 / 42

Page 12: Towards the Cloud: Event-driven Architectures in PHP

Tags and User

class User{

public $id;public $username;public $friends = array ();public $photos = array ();

}

class Tag{

public $id;public $name;public $photos = array ();

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 7 / 42

Page 13: Towards the Cloud: Event-driven Architectures in PHP

Photo Service

interface PhotoService{

function uploadRequestIsValid($post , $files);

function findOrCreateTags(array $tagNames);

function createPhoto($name , array $tags , User $user);

function saveToDb(Photo $photo);

function extractExifMetadata(Photo $photo);

function performResizes(Photo $photo);

function moveUploadedPhotoFile(Photo $photo , $file);

function notifyFriends(Photo $photo);}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 8 / 42

Page 14: Towards the Cloud: Event-driven Architectures in PHP

Upload new Photo

$user = getSessionUser ();$service = new PhotoServiceImpl ();

if($service ->uploadRequestIsValid($_POST , $_FILES)) {// assign $tagNames , $name , $tempFile from Request

$tags = $service ->findOrCreateTags($tagNames);$photo = $service ->createPhoto($name , $tags , $user);

$service ->saveToDb($photo);

$service ->moveUploadedPhotoFile($photo , $tempFile);$service ->extractExifMetadata($photo);$service ->performResizes($photo);$service ->notifyFriends($photo);

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 9 / 42

Page 15: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 16: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 17: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 18: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 19: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 20: Towards the Cloud: Event-driven Architectures in PHP

Possible Problems

I Thumbnail generation

I View Caching

I CDN Distribution

I Payments/Credits

I Statistical Analysis

I Different Configurable Platforms

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 10 / 42

Page 21: Towards the Cloud: Event-driven Architectures in PHP

You are always required to change thecore application!

1. Lots of Coupling.

2. Potential for great complexity.

3. Hard to maintain and test.

4. Not easily scaleable.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 11 / 42

Page 22: Towards the Cloud: Event-driven Architectures in PHP

You are always required to change thecore application!

1. Lots of Coupling.

2. Potential for great complexity.

3. Hard to maintain and test.

4. Not easily scaleable.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 11 / 42

Page 23: Towards the Cloud: Event-driven Architectures in PHP

You are always required to change thecore application!

1. Lots of Coupling.

2. Potential for great complexity.

3. Hard to maintain and test.

4. Not easily scaleable.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 11 / 42

Page 24: Towards the Cloud: Event-driven Architectures in PHP

You are always required to change thecore application!

1. Lots of Coupling.

2. Potential for great complexity.

3. Hard to maintain and test.

4. Not easily scaleable.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 11 / 42

Page 25: Towards the Cloud: Event-driven Architectures in PHP

You are always required to change thecore application!

1. Lots of Coupling.

2. Potential for great complexity.

3. Hard to maintain and test.

4. Not easily scaleable.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 11 / 42

Page 26: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 27: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 28: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 29: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 30: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 31: Towards the Cloud: Event-driven Architectures in PHP

Cronjobs to the Rescue?

I Put work in a queue

I Let a cronjob pick it up

I Or find work with a query

But:

I Not necessarily scaleable or decoupling.

I Single-Threaded

I Delayed by up to a minute

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 12 / 42

Page 32: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

A software architecture where looslycoupled components communicate with

each other by triggering events.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 13 / 42

Page 33: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

1. Decouple responsibilities.

2. Communicate by triggering events.

3. Scale out components.

4. Higher responsiveness (Request MS

decrease).

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 14 / 42

Page 34: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

1. Decouple responsibilities.

2. Communicate by triggering events.

3. Scale out components.

4. Higher responsiveness (Request MS

decrease).

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 14 / 42

Page 35: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

1. Decouple responsibilities.

2. Communicate by triggering events.

3. Scale out components.

4. Higher responsiveness (Request MS

decrease).

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 14 / 42

Page 36: Towards the Cloud: Event-driven Architectures in PHP

Event-Driven Architectures

1. Decouple responsibilities.

2. Communicate by triggering events.

3. Scale out components.

4. Higher responsiveness (Request MS

decrease).

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 14 / 42

Page 37: Towards the Cloud: Event-driven Architectures in PHP

What is an Event?

“An event is a significantchange in state, which can betriggered from inside or outsidethe application.”

Wikipedia

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 15 / 42

Page 38: Towards the Cloud: Event-driven Architectures in PHP

What is an Event?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 16 / 42

Page 39: Towards the Cloud: Event-driven Architectures in PHP

Uploading an Image

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 17 / 42

Page 40: Towards the Cloud: Event-driven Architectures in PHP

Patterns for Event-Driven Architectures

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 18 / 42

Page 41: Towards the Cloud: Event-driven Architectures in PHP

Subject-Observer Pattern #1

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 19 / 42

Page 42: Towards the Cloud: Event-driven Architectures in PHP

Subject-Observer Pattern #2

class PhotoUploader implements SplObserver{

function update(SplSubject $photo) {$this ->moveUploadedFile($photo);

}//...

}

class PhotoThumbGenerator implements SplObserver{

function update(SplSubject $photo) {$this ->performResizes($photo);

}//...

}

class PhotoMetadataExtractor implements SplObserver { }

class NewPhotoFriendsNotifier implements SplObserver { }

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 20 / 42

Page 43: Towards the Cloud: Event-driven Architectures in PHP

Subject-Observer Pattern #3

class Photo implements SplSubject{

private $observers = null;

function __construct () {$this ->observers = new SplObjectStorage ();$this ->attach(new PhotoUploader ());$this ->attach(new PhotoThumbGenerator ());$this ->attach(new PhotoMetadataExtractor ());$this ->attach(new NewPhotoFriendsNotifier ());

}

function notify () {foreach($this ->observers AS $observer) {

$observer ->update($this);}

}}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 21 / 42

Page 44: Towards the Cloud: Event-driven Architectures in PHP

Subject-Observer Pattern #4

// $service instanceof PhotoServiceif($service ->uploadRequestIsValid($_POST , $_FILES)) {

// assign $tagNames , $name , $tempFile from Request

$tags = $service ->findOrCreateTags($tagNames);$photo = $service ->createPhoto($name , $tags , $user);

$service ->moveUploadedPhotoFile($photo , $tempFile);$service ->extractExifMetadata($photo);$service ->performResizes($photo);$service ->notifyFriends($photo);

$service ->saveToDb($photo);}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 22 / 42

Page 45: Towards the Cloud: Event-driven Architectures in PHP

Subject-Observer Pattern #5

// $service instanceof PhotoServiceif($service ->uploadRequestIsValid($_POST , $_FILES)) {

// assign $tagNames , $name , $tempFile from Request

$tags = $service ->findOrCreateTags($tagNames);$photo = $service ->createPhoto($name , $tags , $user);

$photo ->notify ();

$service ->saveToDb($photo);}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 23 / 42

Page 46: Towards the Cloud: Event-driven Architectures in PHP

Still too much coupling!

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 24 / 42

Page 47: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #1

I Decouple Subject-Observer

I Introduce Event-Dispatcher Object

I Acts as Mediator between Subjects and

Observers

I Introduces Notion of a Channel

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 25 / 42

Page 48: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #1

I Decouple Subject-Observer

I Introduce Event-Dispatcher Object

I Acts as Mediator between Subjects and

Observers

I Introduces Notion of a Channel

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 25 / 42

Page 49: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #1

I Decouple Subject-Observer

I Introduce Event-Dispatcher Object

I Acts as Mediator between Subjects and

Observers

I Introduces Notion of a Channel

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 25 / 42

Page 50: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #1

I Decouple Subject-Observer

I Introduce Event-Dispatcher Object

I Acts as Mediator between Subjects and

Observers

I Introduces Notion of a Channel

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 25 / 42

Page 51: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #2

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 26 / 42

Page 52: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #3

$dispatcher = new EventDispatcher ();$dispatcher ->attach("pre_save_photo", array(

new PhotoVirusScanner (),new PhotoIsValidImage (),

));$dispatcher ->attach("post_save_photo", array(

new PhotoThumbGenerator (),new PhotoCdnUploader (),new PhotoMetadataExtractor (),new NewPhotoFriendsNotifier ()

));

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 27 / 42

Page 53: Towards the Cloud: Event-driven Architectures in PHP

Event-Dispatcher Pattern #4

$user = getSessionUser ();$service = new PhotoServiceImpl ();// $service instanceof PhotoServiceif($service ->uploadRequestIsValid($_POST , $_FILES)) {

// assign $tagNames , $name , $tempFile from Request$tags = $service ->findOrCreateTags($tagNames);$photo = $service ->createPhoto($name , $tags , $user);

$dispatcher ->notify("pre_save_photo", $photo);

$service ->saveToDb($photo);

$dispatcher ->notify("post_save_photo", $photo);

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 28 / 42

Page 54: Towards the Cloud: Event-driven Architectures in PHP

Decoupled, Easily Maintainable andRe-Usable Components.

1. Photo, User, Tag Management

2. Photo Validator/Processor

3. Notification Mailer

4. Uploaded File Virus Scanning

5. File CDN Management

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 29 / 42

Page 55: Towards the Cloud: Event-driven Architectures in PHP

Attention!

Avoid using a shared Database

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 30 / 42

Page 56: Towards the Cloud: Event-driven Architectures in PHP

Open Questions

And how is this gonnasave me Request Time?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 31 / 42

Page 57: Towards the Cloud: Event-driven Architectures in PHP

Open Questions

I know all this,what has this to do with the Cloud?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 32 / 42

Page 58: Towards the Cloud: Event-driven Architectures in PHP

Asynchronous Processing

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 33 / 42

Page 59: Towards the Cloud: Event-driven Architectures in PHP

Message Systems for PHP

I XMPP

I dropr - https://www.dropr.org/

I Gearman - http://gearman.org/

I + lots of Java based ones

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 34 / 42

Page 60: Towards the Cloud: Event-driven Architectures in PHP

Gearman #1

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 35 / 42

Page 61: Towards the Cloud: Event-driven Architectures in PHP

Gearman #2

Installing on Linux is fairly easy already:root@benny -pc:~$ wget http:// launchpad.net/gearmand/trunk

/0.10/+ download/gearmand -0.10. tar.gzroot@benny -pc:~$ tar xzvf gearmand -0.10. tar.gzroot@benny -pc:~$ cd gearmand -0.10. tar.gzroot@benny -pc:~/ gearmand -0.10$ ./ configureroot@benny -pc:~/ gearmand -0.10$ makeroot@benny -pc:~/ gearmand -0.10$ make installroot@benny -pc:~/ gearmand -0.10$ ldconfigroot@benny -pc:~/ gearmand -0.10$ pecl install gearman -beta

Use packages daemonstools and

start-stop-daemon to manage workers and server

respectively.

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 36 / 42

Page 62: Towards the Cloud: Event-driven Architectures in PHP

PHP Gearman-Dispatcher

class GearmanEventDispatcher{

private $client;private $list = array();

function __construct () {$this ->client = new GearmanClient ();$this ->client ->addServer("127.0.0.1");

}

function notify($channel , $context) { }}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 37 / 42

Page 63: Towards the Cloud: Event-driven Architectures in PHP

PHP Gearman-Dispatcher

class GearmanEventDispatcher{

function notify($channel , $context) {$contextData = serialize($context);foreach($this ->list[$channel] AS $listener) {

$listenerTaskName = $listener ->getTaskName ();if($listener ->isAsync ()) {

$this ->client ->doBackground($listenerTaskName , $contextData);

} else {$this ->client ->do(

$listenerTaskName , $contextData);}

}}

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 38 / 42

Page 64: Towards the Cloud: Event-driven Architectures in PHP

Gearman Worker

$uploader = new LoadUnserializer(new PhotoUploader ());$thumbGenerator = new LoadUnserializer(

new PhotoThumbGenerator ());

$worker= new GearmanWorker ();$worker ->addServer("127.0.0.1");$worker ->addFunction("upload_photo",

array($uploader , ’update ’));$worker ->addFunction("generate_thumb",

array($thumbGenerator , ’update ’));

while($worker ->work()) {// handle errors and return values here..

}

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 39 / 42

Page 65: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 66: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 67: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 68: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 69: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 70: Towards the Cloud: Event-driven Architectures in PHP

No need to stop here!

I We only looked at the model.

I Controller/View can also be an

Event-Dispatcher.

I Call several independant model

I Pre-calculate Ajax calls in main controller.

I Run your Test-Suite on several machines, in

parallel.

I Any more ideas?

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 40 / 42

Page 71: Towards the Cloud: Event-driven Architectures in PHP

Further Readings

I “Enterprise Integration Patterns”, Hohpe, Woolf

I http://gearman.org/index.php?id=presentations

I http://www.php.net/gearman

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 41 / 42

Page 72: Towards the Cloud: Event-driven Architectures in PHP

Thank you!

Please rate this talk at joind.in:

http://joind.in/talk/view/1057

Twitter: @beberlei

Blog: www.whitewashing.de

Eberlei (direkt effekt GmbH) Event-Driven Architectures IPC 09, Karlsruhe 42 / 42