Queues

The User


I don't want to wait till

your application update

cache! 

The product owner


Can we also notify the user
friends when he save

new data?





Development team


Our notification system 

developed using 

Python and Java

Classic workflow

Classic workflow


Queues

 

Improved workflow

 

Improved workflow

 

Improved workflow

RabbitMQ & AMQP


  • RabitMQ - Message broker software
  • Advanced Message Queuing Protocol
    • Completely Open Protocol
    • Binary Protocol
    • AMPQ Model
    • AMPQ Wire Format

AMQP Model


  • Exchanges
  • Message Queues
  • Binding
  • Rules for binding them
  • RPC

Messages flow

Exchange Types


  • Fanout
  • Direct
  • Topic

Fanout Exchange

Direct Exchnage

Topic Exchnage

Remote procedure call

Queue attributes


  • Auto delete
  • Durability
  • Message TTL
  • Auto expire
  • Max length
  • Dead letter exchange
  • Dead letter routing key
  • Arguments

Queue messages attributes


  • Delivery mode
  • Headers
  • Properties
  • Payload

Queue messages


  • Ready
  • Unacknowledged
  • Total


Message rates


  • Publish
  • Deliver
  • Redelivered
  • Acknowledge

RabbitMQ few workers per queue

RabbitMQ management

RabbitMQ management

Redis


RPUSH  LPOP



Implementation


Resque

  • create workers
  • dashboard

Resque worker


  • class
  • behavior
    • setUp
      • before perform
    • perform
      • do Your job
    • tearDown
      • after perform

Enqueue


\Resque::setBackend('localhost:6379');
\Resque::enqueue('Foo', '\App\CoreBundle\Jobs\FooJob', $args);


Dequeue


$ QUEUE=Foo VVERBOSE=1 php resque.php

Workers setup


  • Logs
  • Number of workers
  • Interval
  • Redis backend
  • Verbose
  • Vverbose
  • Queue
  • App include

How it works

Dashboard

Dashboard

Dashboard

Thanx

Queues

By Valerii Sorokobatko