Atlassian Connect add-ons are SaaS applications. Building and running them means planning with operations in mind: where should you host your add-on? What's the best way to deploy it? How can you monitor it once it's live? How much will it cost to run? We'll draw from Atlassian's experiences building Who's Looking for OnDemand (a production Connect add-on installed in 950 instances with 20,000 active users) to explore tips and best practices to help answer these questions and more.
8. Stateless Request Processing
Load Balancer
Data Store
Hosting on a PaaS can encourage
statelessness, which enables
horizontal scalability and
improves resilience.
Requests
app
processes
(dynos)
whoslooking.herokuapp.com
12. Testing
Unit testing: business as usual
Browser tests: similar to in-process add-ons
Run add-on and host app locally
Atlassian SDK, WebDriver, Atlassian Page Objects…
Add post-deployment verification tests
Reliable sanity tests, run after every deployment
Must be runnable against a production instance
13. Testing & Muti-tenancy
Mock out products’ REST APIs to test multi-tenant interactions
(see Who’s Looking source on Bitbucket for examples)
ac-mock-tenants.herokuapp.com
Connect
add-on
14. Load Testing
Load test on free tier, and extrapolate
Use e.g. New Relic to monitor the add-on under load
15. Load Testing
Tool: ac-load-test
Sets up Gatling-based load tests for Connect add-ons
Simulates authenticated requests from 1000s of hosts & users
Connect
add-on
ac-mock-tenants> ./sbt run
ac-load-test
(Gatling)
heavy load
bitbucket.org/atlassianlabs/ac-load-test.g8
Mock OD
instances
JWT-signed
requests
22. Things can still go wrong!
Log management
Set up alerts on log patterns, search logs
Add-ons: Logentries, FlyData, Papertrail…
Feature flags
Turn new features on & off via configuration
Metrics / analytics
Get insight into application behaviour to detect issues
Libraries for in-memory metrics: Simon, Metrics, Servo…
Add-ons for externalised analytics: New Relic, StatsMix, Hosted Graphite…
25. To build a production-ready add-on…
Design for multi-tenancy and horizontal scalability
Ensure deploying is easy
Make the most of 3rd party services
Load test to help estimate running cost
Implement a health check resource & monitor it
Run post-deployment verification tests
Start simple!
26. Who’s Looking Stats
2-4 dynos (average ~3)
5 external services (3 free, 2 paid)
19800 active users last week
960 active instances last week
3500 average rpm (~7500 peak)
<1s average page load time
!
$89.50 / month (~$0.005 / user / month)
Slides:
go.atlassian.com/prod-connect