Upload
fauzan-erich-emmerling
View
183
Download
0
Embed Size (px)
Citation preview
FLASK, MICRO-FRAMEWORK, TO MONOLITH AND BEYOND
ID-PYTHON @CORAL 30-05-2016by @femmerling
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
OBJECTIVES1. WHY FLASK
2. FLASK AS A MICRO-FRAMEWORK
3. FLASK AS A MONOLITH
4. BEYOND MONOLITH
5. QnA
WHY FLASK?#1
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
FLASK IS …▸ simple▸ easy to extend▸ very pythonic▸ built with REST in mind▸ supported by good docs and communities▸ a micro framework for Python based on Werkzeug,
Jinja 2 and good intentions :D
FLASK AS A MICRO FRAMEWORK
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND TEXT
FLASK IS GOOD AS A MICRO-FRAMEWORK▸ Use only what you need ▸ Easy to maintain▸ APIs are very intuitive▸ A cool web app is a single python file away▸ Fun to develop with▸ Low memory consumption
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND TEXT
FLASK IS GOOD AS A MICRO-FRAMEWORK … BUT!▸ it can have a massive 1 source code base when not
managed properly▸ harder team effort▸ scaling means you scale everything
ENTER SEVERAL COMPONENT AND WE HAVE:FLASK AS A MONOLITH#3
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
SOME COMPONENTS WE USE TO CREATE A MONOLITH▸ Flask-Restful (backend FTW)▸ SQLAlchemy (who doesn’t)▸ Flask-OAuthLib (Easy Auth)▸ RQ (Easy async job queues)▸ ElasticSearch (Search Engine FTW)
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
WHY DO WE USE THEM▸ Most usage are in API▸ Easier code maintenance▸ Easier authentication▸ Easier job queue▸ Easier search
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
WE ALSO USE THEM TO▸ Standardize code base▸ Better collaboration▸ Faster iteration time
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
ON THE OTHER HAND WE RUN INTO ISSUES AS WELL▸ Load on several endpoints are causing bottlenecks▸ Several services are taking a ton of resources leaving
smaller room for other use▸ Async jobs are causing bottlenecks▸ Scaling means you scale everything
SO HOW DID WE GOBEYOND MONOLITH
#4
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
GOING BEYOND MONOLITH▸ Implement better codebase structure▸ Extract parts that needs to be scaled▸ Have fun with it on the way
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
GOING BEYOND MONOLITH: CODEBASE STRUCTURE▸ Split codes into domains▸ Each domains have standard namespaces, e.g:
controllers, fields, services, routes
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
GOING BEYOND MONOLITH: EXTRACTION▸ Determine which part needs to be scaled up based on
usage statistics▸ Split into its own micro service and scale by creating
cluster of instances▸ Scale only parts you need▸ Make sure that each micro service is domain based
and will only do anything related to that domain▸ Apache thrift helps a lot in this part
CORALABOUT
ABOUT CORAL▸ We’re On a Mission TO BUILD COOL THINGS FOR SMART
SELLERS▸ We’re an engineering company with genuine focus on
developing a great product, not just developing the market using marketing means
▸ We use plenty of cool technologies, python is definitely included
▸ We live on the edge of development▸ Try out our app on Google Play Store, search for Coral Shop▸ want to know more? -> [email protected] :)
ANYTHING YOU WANT TO ASK?
@femmerling
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND
THANK YOU :)
@femmerling
FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND