20
FLASK, MICRO- FRAMEWORK, TO MONOLITH AND ID-PYTHON @CORAL 30-05-2016 by @femmerling

Coral id-python

Embed Size (px)

Citation preview

Page 1: Coral id-python

FLASK, MICRO-FRAMEWORK, TO MONOLITH AND BEYOND

ID-PYTHON @CORAL 30-05-2016by @femmerling

Page 2: Coral id-python

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

Page 3: Coral id-python

WHY FLASK?#1

Page 4: Coral id-python

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

Page 5: Coral id-python

FLASK AS A MICRO FRAMEWORK

Page 6: Coral id-python

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

Page 7: Coral id-python

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

Page 8: Coral id-python

ENTER SEVERAL COMPONENT AND WE HAVE:FLASK AS A MONOLITH#3

FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND

Page 9: Coral id-python

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)

Page 10: Coral id-python

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

Page 11: Coral id-python

FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND

WE ALSO USE THEM TO▸ Standardize code base▸ Better collaboration▸ Faster iteration time

Page 12: Coral id-python

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

Page 13: Coral id-python

SO HOW DID WE GOBEYOND MONOLITH

#4

FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND

Page 14: Coral id-python

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

Page 15: Coral id-python

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

Page 16: Coral id-python

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

Page 17: Coral id-python

CORALABOUT

Page 18: Coral id-python

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] :)

Page 19: Coral id-python

ANYTHING YOU WANT TO ASK?

@femmerling

FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND

Page 20: Coral id-python

THANK YOU :)

@femmerling

FLASK, MICRO-FRAMEWORK TO MONOLITH AND BEYOND