Evolution of Web Application Architecture · Evolution of Web Application Architecture...
Transcript of Evolution of Web Application Architecture · Evolution of Web Application Architecture...
Evolution of Web Application ArchitectureInternational PHP Conference
Kore Nordmann / @koredn / <[email protected]>June 9th, 2015
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Too many visitors
Evolution
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Load Balancing
I Works because of HTTP & PHPI HTTP is LCoDC$SSI PHP is build for shared-nothing
I Round Robin works bestI Sticky sessions will overload certain servers
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Non-sticky session – how?
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Where to put the static data?
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Static Files
I NFS will eventually lead to dead locksI . . . still seems the most popular solution around.
I Multiple domains can hurt performance (TCP slow start)I Using dedicated CDN providers can help
I Content locality
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
DB server too slow
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Replicate Database
I Master Slave Replication is fairly easy to set upI Obviously only scales READsI WRITEs are usually not your first problem
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
DB servers are too expensive
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Cache With Memcache
I Cache all the things in memoryI Cache entitiesI Cache collectionsI Full page cache
I Cache invalidationThere are three hard things in Computer Science:Cache invalidation and off by one errors.
I Cache dependency calculationI The n + 1 problem
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Too many writes
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Sharding
I Shard by tableI . . . or even shard by consistent hash per entityI No referential integrity checking
I Queries are limited to sharding solutionI Schema updates across multiple shards are fun
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Database setup too complex
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: NoSQL
I Usually solves one problem really well:I ShardingI Multi-Master-ReplicationI Cross-shard queries
I . . . we lost all relevant features from Relational DatabaseManagement Systems anyways. . .
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
Business wants to query data
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Map-Reduce
I Execute queries on distributed databasesI New query language to learn
I Your developers write analysis scripts, instead of the businessanalysts writing SQL slow queries
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Problem
How to orchestrate?
Evolution
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned: Queues
I Queues can ensure data is processed asynchronouslyI Following the data flow of an action can be “tricky”
I Used to distribute data between systems
Evolution
Microservices
I Microservices can simplify things:I Separate services by concern or teamI Decide on technology stack per service
I Microservices will also complicate things:I Deployment automation is a mustI Service orchestration is still a problemI Service downtimes and latency must be handled gracefully
I Big DataTM will stay a problem
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Lessons Learned (subjective)
I Boring technology choices will often work bestI Just start & stay with LAMP?
I Only bring in shiny new technologies with careI There are enough reasons to eventually do that, though
Copyright Qafoo GmbH; All Rights Reservedtalks.qafoo.com
Conclusion
There is no conclusion
Do not jump on every bandwagon – this includesmicroservices