from delivering plugins to delivering "as a service" - atlassian connect 2017
TRANSCRIPT
X fact to scale out
From delivering plugins to delivering "as a Service", some advices to run it easilyQuentin ADAM atAtlassian connect week 2017@waxzce2013
Quentin ADAM from the Clever Cloud@waxzce on twitter github- soundcloud instagram .Who am I ?
My day to day work : Clever Cloud, the IT automation company
Keep your apps online. made with node.js, scala, java, ruby, php, python, go
Cloud & on premise ;-)
And learn a lot of things about your code, apps, and good/bad design
Give back to the community
NEVER GONNA LET YOU DOWNclever-cloud.com
From shipping jar to operate a service
When you need to scaleThere are 2 ways
Growing and growing until you explode or become weird
Or split the work and make your software work as a team
Build an army of fat appYou can do both
So we need to be able to dispatch the workScale outMany workers doing the same thingNo SPOFGrowing is more easyIntroduce best practice
Scale up1 Fat instance1 Fat applicationSPOF (single point of failure)Hard to maintainAlways has a limitShort term meaningBest long term solution
If you only scale up, you gonna have a bad time
So, how to scale out ?Just some facts
Split process and storage
Picking one instance or another doesnt matterStatelessness is the key
Consider more things as dataUser accountUsers dataFilesSessionsEvents
Understand what is provided
Trust your middleware
Use an event broker to modularize your app
Use an event broker to modularize your appAMQPCelery 0MQRedisJMSEven some http chunk or websocketSome case : hadoop, akka
My talk about rabbitMQ: https://www.youtube.com/watch?v=15mzY2MfDgM&t=3s
My talk about rabbitMQ: https://www.youtube.com/watch?v=15mzY2MfDgM&t=3s Cron + FS is neither an event queue nor a job scheduler
Big change in software industryOne instance One organizationOne data repositoryOne instance (distributed)Multiple organization + a lot of usersOne data repository
YestedayNowMulti-tenant
Its a big impact on data management23
Instance for one OrganizationTake advantage of ACID database
But it designs a bottleneck
Example : e-shop on classic mode
Example : e-shop on classic modeUser A buy a hdd
Database Transaction :Stock managementOrder managementInvoice generationCustomer Account rewardTransaction user A is processed Stock & Order are just perfectly synchronize
Example : e-shop on classic modeUser A buy a hdd
Database Transaction :Stock managementOrder managementInvoice generationCustomer Account rewardTransaction user A is processed Stock & Order are just perfectly synchronizeUser B buy a hddTransaction user B is processed then
Example : e-shop on multi-tenant modei.e. : Multiple shop of various sellers on the same instance
Example : e-shop on multi-tenant modeUser A buy a hdd on seller A
Database Transaction :Stock managementOrder managementInvoice generationCustomer Account rewardTransaction user A is processed Stock & Order are just perfectly synchronizeUser B buy a book on seller BTransaction user B is processed then
Who care the synchronization of vendor A & B ?
Choose your datastore wisely
You can should use many datastores
Datastore choices are driven by usage
Use online database / be ready to test in just a few minutes No need to trash your computer
{P, DB, S} aaSUse ops free solution to learn and start
Common mistakes
Do not use the file system as a datastoreFile system are POSIX compliantPOSIX is ACIDPOSIX is powerful but is a bottleneck File System is the nightmare of ops File System creates coupling (host provider/OS/language)SPOF-free multi tenant File System is a unicorn
Store in database, or in a datastore like S3/riakCS dedicated to file management
Do not use the file system as a datastore
Logs in files I hate it
Use streaming I/O to stream data directly to database
Use streaming I/O to stream data directly to database
Do not use memory as databaseLike : Shared / global variable, cache in the code, intensive session usage
Do not use a variable for more than one request
disposable43
F(x) = x * 2f(2) = 4^ we assume thatFor same input, same output
Its like math function
Example : GET should not change data on serverRespect http
data will be lostCode will fail
Careful use of dark magic
Dont be that guy
Do not use a technology because you