More Related Content Similar to Astricon 2016 - Scaling ARI and Production (20) More from Dan Jenkins (20) Astricon 2016 - Scaling ARI and Production11. Scaling is how we
handle traffic to and
from Asterisk via the
ARI interface in a way
that we can
support load
@dan_jenkins
13. How to architect your ARI
app for running in
production, failing over,
monitoring and reporting
@dan_jenkins
19. Built in, no thought needed.
Contributors have sorted
everything...right?
@dan_jenkins
31. You can load balance
these calls out using a
TCP Proxy
@dan_jenkins
33. But there are reasons
I love the ARI
compared to
AMI and AGI
@dan_jenkins
37. Before we look at how
to scale the ARI, we
need to understand
what it is
@dan_jenkins
39. Dialplan
Its beautiful isn't it? 4 lines. That's it!
(It would be better without the Dialplan)
[Astricon]
exten = 100,1,Verbose(1, "Astricon call, woot")
same = n,Stasis(dangerous-demos)
same = n,Hangup()
@dan_jenkins
41. HTTP
curl -v -u asterisk:asterisk -X POST "http://
localhost:8088/ari/channels/1400609726.3/
play?media=sound:hello-world"
@dan_jenkins
42. Websocket
{
"application":"hello-world",
"type":"StasisStart",
"timestamp":"2014-05-20T13:15:27.131-0500",
"args":[],
"channel":{
"id":"1400609726.3",
"state":"Up",
"name":"PJSIP/1000-00000001",
"caller":{
"name":"",
"number":""},
"connected":{
"name":"",
"number":""},
"accountcode":"",
"dialplan":{
"context":"default",
"exten":"1000",
"priority":3},
"creationtime":"2014-05-20T13:15:26.628-0500"}
}
@dan_jenkins
47. In attempt to fix that, you'd
put Asterisk on a bigger
box
@dan_jenkins
48. Or spin up another and put
it behind a SIP proxy or
something
@dan_jenkins
56. So what do we need to
care about when building
& deploying your ARI app?
@dan_jenkins
66. Don't aim to replace
app_dial / app_queue /
app_voicemail / *
@dan_jenkins
70. Pipe that data to a
centralised place
The ELK Stack for example
(Elasticserch | Logstash | Kibana)
@dan_jenkins
73. Send stats out of your
application
StatsD - data points specific to your
application
@dan_jenkins
74. And then graph and
utilise them
(Telegraf | InfluxDB | Grafana)
@dan_jenkins
76. Does your app need to talk
to other apps serving the
same ARI app name?
@dan_jenkins
77. Got a call on another
Asterisk/ARI app and need
to terminate it?
@dan_jenkins
78. How do you tell that other
App to terminate the call?
@dan_jenkins
89. If there is state involved
then the application deals
with that
@dan_jenkins
92. You can't have multiple
Websockets tied to one
Asterisk using the same
App name
@dan_jenkins
96. You can have one web
socket handle
multiple app names
@dan_jenkins
100. Pros and Cons
Pros Cons
• Simple • Doesn't scale
• You lose all your calls when
your app fails
@dan_jenkins
103. Pros and Cons
Pros Cons
• Can potentially handle
more calls than a single
Asterisk
• Doesn't scale
• You lose all your calls when
your app fails
• There will eventually be a
bottleneck in your
application
@dan_jenkins
106. Pros and Cons
Pros Cons
• Fairly simple • You lose all calls on that
Asterisk when your app
fails
• Nightmare configuring it
• Not flexible
@dan_jenkins
109. Pros and Cons
Pros Cons
• There are none • Complicated to maintain in
your Dialpan
• If Asterisk dies, you lose all
your calls
@dan_jenkins
113. Pros and Cons
Pros Cons
• There are none • Complicated to maintain in
your Dialpan
• If Asterisk dies, you lose all
your calls
• A huge mess
@dan_jenkins
118. 2 ARI Proxies
Available
Both support the same Message Bus Message format
(https://github.com/nvisibleinc/go-ari-library/wiki/Message-Format)
@dan_jenkins
130. But that's no different to
learning how to
ride your bike
without stabilisers
@dan_jenkins
131. And you don't ride
your bike with
stabilisers any more
do you?
@dan_jenkins
132. Its time to get on the bike
and start peddling
@dan_jenkins
134. But if you do, just get back up and try again
@dan_jenkins