Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Asynchronous Data Processing

Asynchronous Data Processing

Choosing the right way to process data might become a strategic and non trivial decision for many kind of applications. Especially in applications where an high percentage of the time is spent elaborating informations behind the scenes. A solution could be to use a message queuing system for processing data asyncronously. Using AMQP it becomes possible to define different types of queue patterns in order to solve different types of problems.
The purpose of the talk is to show how to approach the diffentent scenarios in php adding a great value to your application.

Andrea Giuliano

September 27, 2015
Tweet

More Decks by Andrea Giuliano

Other Decks in Technology

Transcript

  1. A S Y N C H R O N O

    U S D ATA P R O C E S S I N G Andrea Giuliano @bit_shark B u l g a r i a P H P C O N F E R E N C E September 27th, 2015
  2. Pros Cons • easy to reason about • immediate feedback

    • client can get stuck • impractical in low latency env SYNCHRONOUS COMMUNICATION
  3. • useful for long-running jobs • systems decoupled • scales

    well (event-based) • additional system requirements ASYNCHRONOUS COMMUNICATION Pros Cons
  4. P R O D U C E R C O

    N S U M E R Produce Consumes B R O K E R ENTITIES INVOLVED
  5. P R O D U C E R C O

    N S U M E R Produce Exchange Consumes B R O K E R THE BROKER
  6. P R O D U C E R C O

    N S U M E R Produce Exchange Routes Consumes B R O K E R THE BROKER
  7. P R O D U C E R C O

    N S U M E R Produce Exchange Queue Routes Consumes B R O K E R THE BROKER
  8. P R O D U C E R C O

    N S U M E R Q U E U E PRODUCER/CONSUMER
  9. SCALING UP P R O D U C E R

    C O N S U M E R Q U E U E C O N S U M E R …
  10. C O N S U M E R C O

    N S U M E R ROUND ROBIN DISPATCHING
  11. C O N S U M E R C O

    N S U M E R ROUND ROBIN DISPATCHING
  12. C O N S U M E R C O

    N S U M E R ROUND ROBIN DISPATCHING
  13. C O N S U M E R C O

    N S U M E R ROUND ROBIN DISPATCHING !
  14. FAIR DISPATCHING C O N S U M E R

    C O N S U M E R ack
  15. PUBLISH/SUBSCRIBE P U B L I S H E R

    S U B S C R I B E R Q U E U E S U B S C R I B E R S U B S C R I B E R
  16. PUBLISH/SUBSCRIBE M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R tell me when a user is created tell me when a user is created tell me when a user is created
  17. PUBLISH/SUBSCRIBE M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E U S E R S E R V I C E B R O K E R username: agiuliano password: ****** mail: ***@gmail.com UserCreated
  18. PUBLISH/SUBSCRIBE M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R UserCreated UserCreated UserCreated
  19. PUBLISH/SUBSCRIBE U S E R S E R V I

    C E B R O K E R UserCreated
  20. PUBLISH/SUBSCRIBE M A I L S E R V I

    C E B R O K E R tell me when a user is created
  21. ROUTING M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [UserCreated, UserUpdated] UserCreated UserCreated
  22. ROUTING U S E R S E R V I

    C E B R O K E R UserUpdated routing key: updated
  23. ROUTING M A I L S E R V I

    C E B R O K E R routing keys: [created, updated]
  24. ROUTING M A I L S E R V I

    C E B R O K E R routing keys: [created, updated]
  25. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased]
  26. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] U S E R S E R V I C E <user. created>
  27. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] U S E R S E R V I C E <user. created>
  28. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] U S E R S E R V I C E <user. updated>
  29. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] U S E R S E R V I C E <user. updated>
  30. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] S T O R E S E R V I C E <item.purchased>
  31. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] S T O R E S E R V I C E <item.purchased>
  32. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] S T O R E S E R V I C E <item.created>
  33. TOPIC M A I L S E R V I

    C E A U T H S E R V I C E C O U P O N S E R V I C E B R O K E R [user. *] [user. created] [user. created, *.purchased] S T O R E S E R V I C E <item.created>
  34. CREDITS • www.flickr.com/photos/rayofsun/9401226342 • www.flickr.com/photos/kalexanderson/6231391820 • www.flickr.com/photos/dhammza/2891991931 • www.flickr.com/photos/kevlewis/15372562472 •

    www.flickr.com/photos/hohumhobo/6349729535 • www.flickr.com/photos/107346206 • www.flickr.com/photos/berlin_steve/8414515260 • www.flickr.com/photos/s3a/4816966416 • www.flickr.com/photos/thatguyfromcchs08/2300190277 • www.flickr.com/photos/toniblay/52445415 • www.flickr.com/photos/bobsfever/8226802321 • www.flickr.com/photos/activars/6590201161 • www.flickr.com/photos/michaeljzealot/6485009571