Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Refactoring to Microservices

259 visualizaciones

Publicado el

A presentation on clearly defining a microservice architecture, culture, and discovering how to determine whether it is a step in the right direction for your system. I discuss about the decisions that lead us to take on a microservice architecture approach at Sprout, and the challenges we are facing as a startup learning a new method for making apps.

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Refactoring to Microservices

  1. 1. Refactoring to Microservices Moving away from old school servers and into the cloud
  2. 2. ASK AWAY! Step 1. Go to slido.com Step 2. Key in #SproutAcademy in the event code. Step 3. Type your questions. Wifi name: KMC Wifi password: S0lstic3!
  3. 3. About Me Senior Architect at Sprout Solutions Microsoft MVP for Visual Studio and Development Technologies User Group Lead of the Philippine .NET Users Group (PHINUG)
  4. 4. Not so long ago in a country far far away...
  5. 5. In January 2009 a startup purchased 3 servers... Web Database 2 servers 1 server 4 cores, 2.83 GHz, 12 MB L2 cache 8 cores, 2.5 GHz, 24 MB L2 cache 8 GB RAM 24 GB RAM 500 GB RAID 1 mirror array (hot-fail, cold-swap) 500 GB RAID 10 array (hot-swap, up to 2 drives at once) dual redundant power supplies Total Cost: ~$5500 (one time) + colocation fee
  6. 6. Had to expand by December... January 2009 December 2009
  7. 7. Seven years later... Web Main Database Everything else DB And a bunch of other servers... 11 servers 2 servers 2 servers ● Service Servers ● Redis Servers ● Elasticsearch Servers ● HAProxy Load Balancer Servers ● Machine Learning Servers ● Logstash Servers ● HTTP Logging SQL Server 12 cores @2.6-3.5 GHz 12 cores @2.7-3.5 GHz 8 cores @3.2-3.6GHz 64 GB RAM 384 GB RAM 768 GB RAM 2x 300GB SATA SSDs RAID 1 4 TB PCIe SSD (RAID 0) + 24 x 200 GB SATA SSDs (RAID 10) 3x 2 TB PCIe SSD (Raid 0) + 24 x 1.2 TB SATA HDDs (RAID 10) Dual 10Gbps network Dual 10Gbps network Dual 10 Gbps network Total Cost: $$$$$$$$$$$$
  8. 8. And their data center looks like...
  9. 9. Statistics for 2016 209,420,973 HTTP requests to our load balancer 66,294,789 page loads 504,816,843 SQL Queries (from HTTP requests alone) 5,831,683,114 Redis hits 17,158,874 Elastic searches 607,073,066 ms (168 hours) spent running SQL queries 10,396,073 ms (2.8 hours) spent on Redis hits 1,609,944,301 ms (447 hours) spent processing in ASP.Net
  10. 10. That’s the story of...
  11. 11. Highly performant apps can be achieved with well designed monoliths
  12. 12. Monoliths are not necessarily bad Simplicity Consistency Inter-module refactoring
  13. 13. So why would you use microservices?
  14. 14. Let’s talk about
  15. 15. Sprout also begins its story in 2009 with...
  16. 16. Typical monolithic WISA application except... ASP.NET Web Application Written in C# Runs on IIS SQL Server Database Inherently multi-tenant
  17. 17. Then came along...
  18. 18. Integration became a business need... Biometric data upload Data integration between apps
  19. 19. More clients & users meant more business needs came along... Biometric data upload Data integration between apps Clients need APIs High Availability Performance New products Tangential features Better UX
  20. 20. Microservices should answer concrete business needs
  21. 21. Monolithic app vs. Microservice apps
  22. 22. You have a true microservice when you achieve... Componentization via services Organized around business capabilities Products not Projects Smart endpoints vs. dumb pipes Decentralized governance Decentralized data management Infrastructure automation Design for failure Evolutionary Design
  23. 23. Componentization via services Payrol l HR ● Authentication ● Employee 201 ● Attendance ● Performance ● Movement ● Compliance ● Loans ● Authentication ● Attendance ● Taxation ● Loans ● Accounting ● Compliance
  24. 24. Componentization via services Payrol l HR Employee 201 Attendance Performance Movement Compliance Loans Accounting Taxation Authentication
  25. 25. Organized around business capabilities Each team must be full stack Developer QA UI DBA System Admins/Devs } DevOps culture
  26. 26. Products not projects Each team must have a dedicated product owner Preferably a domain expert Otherwise needs to have immersed with end users Team should be concerned over the product lifetime
  27. 27. Refactoring to microservices means reorganizing your team
  28. 28. Smart endpoints vs. dumb pipes Endpoints should have full business logic Security Data validation Error handling Logging Do not make CRUD endpoints
  29. 29. Decentralized governance & data management Each team must have a say on their development stack UI/UX Backend QA Each team must have a say on their data store SQL vs. No SQL? Must otherwise be compliant with business requirements
  30. 30. Infrastructure automation Capability to quickly provision servers Quickly scale based on need Ability to deploy applications rapidly
  31. 31. Design for failure Gracefully handle errors Rapidly provide feedback on errors Logging and monitoring
  32. 32. Evolutionary Design Services should be able to change without breaking Handle both old and new endpoints Deprecate over time
  33. 33. Microservices have their own benefits Partial Deployment High Availability Preserve Modularity Multiple Platforms
  34. 34. Our microservices journey so far
  35. 35. Microservices across products PayrollHR Project X ● Authentication ● Employee 201 ● Attendance ● Performance ● Movement ● Compliance ● Loans ● Authentication ● Attendance ● Taxation ● Loans ● Accounting ● Compliance Employee 201
  36. 36. Challenges: Infrastructure Web Live Data Live Web Test Data Test vs
  37. 37. Option 1: On Premise Web Live Data Live Web Test Data Test ● Pros: Greater degree of control, more cost effective (up to a certain point) ● Cons: More difficult to expand and provision, less resilient to downtime, need relevant skillset
  38. 38. Option 2: Public Cloud (AWS / Azure / Google) ● Pros: Faster provisioning, more resilient, less management overhead ● Cons: Beefed up specs and bandwidth are costlier, hidden costs, data residency complications
  39. 39. Challenges: Data architecture Employee 201Sprout HR Sprout Payroll Sharded by tenant Sharded by tenant New!
  40. 40. Option 1: Unsharded data Sprout HR Sprout Payroll Sharded by tenant Sharded by tenant ● Pros: Simpler data access, easier maintenance for backups & business continuity ● Cons: Lost data isolation, potential bottlenecks at data layer Employee 201
  41. 41. Option 2: Aggressive sharding Sprout HR Sprout Payroll Sharded by tenant and by employee table Sharded by tenant ● Pros: Greater data isolation and modularity; Shards could be deployed to separate servers for better throughput ● Cons: More difficult maintenance for backups & business continuity Employee 201
  42. 42. Our journey towards... Componentization via services Organized around business capabilities Products not Projects Smart endpoints vs. dumb pipes Decentralized governance Decentralized data management Infrastructure automation Design for failure Evolutionary Design
  43. 43. Will be continued...
  44. 44. Panel / Q&A Thank you very much!
  45. 45. References https://stackoverflow.blog/2009/01/12/new-stack-overflow-server-glamour-shots/ https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016- edition/ http://blog.serverfault.com/2015/03/05/how-we-upgrade-a-live-data-center/ https://martinfowler.com/articles/microservices.html GOTO 2014 - Microservices - Martin Fowler https://youtu.be/wgdBVIX9ifA

×