Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Zen and the art of beer fermentation observability

82 views

Published on

Craft beer brewing exists for almost 50 years. While all you need in order to brew your own beer is just a big pot and a stirring spoon, we can do it even more fun as a technology moves forward. IoT devices are everywhere and the beer industry doesn’t stand behind. In this presentation, we are going to play with some sensors and build a small serverless application to keep track of beer fermentation.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Zen and the art of beer fermentation observability

  1. 1. Zen and the art of beer fermentation observability Ilya Libin - Epsagon 🍺
  2. 2. >whoami • Product manager at Epsagon • Father - 7 month • Prev: Fiverr, Moonsoft
  3. 3. Some one can tell me what’s happening here? Cool so there are some brewers in here. Amazing.
  4. 4. “Hedgehog In The Fog” brewery Some one can tell me what’s happening here?
  5. 5. Zen and the art of beer fermentation observability Ilya Libin - Epsagon 🍺
  6. 6. Tell me more about this thing you brew at home?
  7. 7. Home brewing process What is really interesting is what’s happen here. (pointing on a fermentation tank) What we basically have here it’s a sweet wort. And we can measure how sweet is it.
  8. 8. Measuring wort gravity Here how we do this… But why is it interesting to us? Anybody can tell?
  9. 9. ABV = (OG - FG) * 131.25. ABV - alcohol by volume
  10. 10. iSpindel - http://www.ispindel.de/ Ok cool, now when we have this device ready and reading data from our fermentation tank, we need somehow to store it somewhere.
  11. 11. Tilt based measurement
  12. 12. MPU-6050 3-Axis Accelerometer and wifi Arduino board
  13. 13. King of coldstarts in serverless land Somewhere in the cloud. And we are going to use serverless for this. OFCOURSE WE ARE GOIN TO USER SERVERLESS. OF COURSE! Because who want’s to build a server app now, who want’s to configure a linux machine and install mysql or whatever and configure ngnix. Here is a cool thing that serverless brings to makers. Before serverless side projects were looking like this:
  14. 14. Side projects before serverless This is me trying to understand why I get 502 HTTP Error from ngnix. While all I want is to have some beer fermentation.
  15. 15. Side projects with serverless While now engeneering look like this. You just pick components stitch it together and get your project up and running. Fully managed full scalable.
  16. 16. 1.Read datapoint from the fermentation tank. 2.Store datapoints in the database. 3.See a gravity chart and be able to access it from anywhere 4.Get alerted when fermentation is over. Requirements So here are some requirements for the project: Read datapoint from the fermentation tank. Ok this is ready.
  17. 17. 1.Read datapoint from the fermentation tank. 2.Store datapoints in the database. 3.See a gravity chart and be able to access it from anywhere 4.Get alerted when fermentation is over. Requirements We have a sensor that does it. Next - Store datapoint in a database. That we need to fetch all those data and present on a chart. And bonus feature - I want to be alerted once the fermentation is over.
  18. 18. DynamoDB This is what we are going to build for the rest of this presentation. I choose DynamboDB for this purpose. Store datapoints in the database.
  19. 19. Store datapoints in the database. { beer_name: HASH, timestamp: RANGE, gravity: N } DynamoDB
  20. 20. Store datapoints in the database. { beer_name: HASH, timestamp: RANGE, gravity: N } datapoints.create
  21. 21. Store datapoints in the database. { beer_name: HASH, timestamp: RANGE, gravity: N } POST /datapoints datapoints.create So far so good.
  22. 22. Datapoints Fetch datapoints for the chart
  23. 23. GET /datapoints datapoints.index Datapoints Fetch datapoints for the chart
  24. 24. Fetch datapoints for the chart GET /datapoints datapoints.index Datapoints
  25. 25. GET /datapoints datapoints.index 🤔 Datapoints 30*60*24*21 = 907000 datapoints Fetch datapoints for the chart
  26. 26. Calculating averages Datapoints
  27. 27. Calculating averages statistics.averages { beer_name: HASH, timestamp: RANGE, average_gravity: N, count: N } Datapoints
  28. 28. Calculating averages statistics.averages { beer_name: HASH, timestamp: RANGE, average_gravity: N, count: N } Datapoints DynamoDB streams
  29. 29. Fetching datapoint for FE statistics.averages Datapoints GET /datapoints datapoints.index Averages
  30. 30. Fermentation chart
  31. 31. Requirements 1.Read datapoint from the fermentation tank. 2.Store datapoint in database. 3.See a chart of a temperature and gravity and be able to access it from anywhere 4.Get alerted when fermentation is over.
  32. 32. Averages DatapointsPOST /datapoints GET /datapoints
  33. 33. Averages DatapointsPOST /datapoints GET /datapoints ?
  34. 34. CloudWatch event Invoke lambda (once | X) a ( minute | day )
  35. 35. Averages DatapointsPOST /datapoints GET /datapoints statistics.is_finished rate(1 day)
  36. 36. Averages DatapointsPOST /datapoints GET /datapoints statistics.is_finished Amazon SES
  37. 37. Costs 1. Datapoint sent every 2 seconds 2. 30*60*24*21 = 907000 datapoints Lambda: 0.2$ API Gateway: 3.5$ Dynamodb: 1.25$ For the second 1,000,000 invocations Per 1,000,000 requests Per 1,000,000 writes total: 4.95$
  38. 38. Averages DatapointsPOST /datapoints GET /datapoints statistics.is_finished Amazon SES
  39. 39. Epsagon - Serverless debugging bazooka. • 100% serverless! (AWS) • Built for developers by developers • We use Epsagon to monitor Epsagon.
  40. 40. “Sometimes it's a little better to travel than to arrive”  ― Robert M. Pirsig, Zen and the Art of Motorcycle Maintenance Conclusion

×