A detailed walk-through from the CTO of Swig, a photo journal for drink enthusiasts. The Swig team wrote their own analytics server using web sockets and Aerospike to provide a live view of photo counts on iOS. A detailed overview will be presented on how the app was set up, including deployment, Aerospike configuration, web socket pooling approach, hosting, monitoring and load testing techniques.
1. Analytics with Go & Aerospike
Nick Manning, CTO at Swig Labs
@seenickcode
2. Our App
• Swig: your mobile drink journal for iOS and Android
• Explore the best of Beer, Wine, Cocktails or Spirits in your
city and follow friends and industry influencers.
5. Analytics Setup
iOS
Go
Aerospike
“Increment photo 1853 by 3 views”
“Increment value in Bin”Ubuntu
Server
Client
“This list of photos
now has these
additional view
counts”
“Give me a live feed
for any newly-
incremented view
counts”
6. • An open-source, real-time, in-memory, ACID compliant
key-value store
• Scale clusters automatically without need for restarts.
• Cross data center data replication with immediate
consistency.
• Responses are predictably fast and data is not cached.
• Achieves 1m transactions/sec on commodity hardware
7. • Full featured Go client is maintained by the company
• Read/writes are performed on microsecond levels
• Supports complex data types
• Solid documentation
• Vetted technology and impressive customer list
9. iOS Setup
Tap Event
Device Cache
Keep a record of photo IDs and counts
Periodically report latest cache to server
API
POST /photos/<id>/views
10. Go Setup
Incoming HTTP POST
Hub Aerospike Client
2. Increment Bin
Pool
Pool
Pool 1. Persist
3. Inform Hub
4. Find the
appropriate pool
for this photo ID
Socket
Connection
Socket
Connection
Socket
Connection
Socket
Connection
iOS User iOS User iOS User iOS User
5. Send new view count
as socket message