Book Image

Hands-On Enterprise Application Development with Python

By : Saurabh Badhwar
Book Image

Hands-On Enterprise Application Development with Python

By: Saurabh Badhwar

Overview of this book

Dynamically typed languages like Python are continuously improving. With the addition of exciting new features and a wide selection of modern libraries and frameworks, Python has emerged as an ideal language for developing enterprise applications. Hands-On Enterprise Application Development with Python will show you how to build effective applications that are stable, secure, and easily scalable. The book is a detailed guide to building an end-to-end enterprise-grade application in Python. You will learn how to effectively implement Python features and design patterns that will positively impact your application lifecycle. The book also covers advanced concurrency techniques that will help you build a RESTful application with an optimized frontend. Given that security and stability are the foundation for an enterprise application, you’ll be trained on effective testing, performance analysis, and security practices, and understand how to embed them in your codebase during the initial phase. You’ll also be guided in how to move on from a monolithic architecture to one that is service oriented, leveraging microservices and serverless deployment techniques. By the end of the book, you will have become proficient at building efficient enterprise applications in Python.
Table of Contents (24 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Chapter 11


Answer 1

The major difference between service-oriented architecture and microservices architecture is the fact that, in a service-oriented architecture, the application consists of different services, each providing the functionality to work on one of the business domains of an organization. These services communicate with each other through the use of the enterprise service bus, which routes the messages from one service to another while also providing a common format for message exchange.

In the case of microservices, the application will consist of a number of small microservices, where each microservice is responsible for providing only a single functionality that may not map to a complete domain of an organization and may just be a subset of larger problem domain. These microservices communicate with each other through the use of APIs exposed by the individual microservices or through the use of stateless message routers that allow the delivery of messages from one service to another.

Answer 2

To ensure that a microservice-based application has a high uptime, we can make use of the following techniques:

  • Not using a single storage for all of the microservices
  • Running multiple instances of the same microservice behind the load balancer
  • Using API gateways to provide graceful degradation in a service where the client still receives a response when a critical service has failed

Answer 3

The use of service-level agreements—or SLAs—provides a number of guarantees, such as the following:

  • A guarantee about the API stability of a service
  • A guarantee about the uptime of a service
  • A guarantee of the expected response times of a service
  • A guarantee of the request rate limitation implemented by a service

Answer 4

The API gateways can communicate directly with the service registry through the use of the SDK provided by the service registry or through the use of the APIs exposed by the service registry. This allows the API gateway to automatically fetch the correct location for a given service from the service registry.

Answer 5

Asynchronous communication inside microservices can be implemented through the use of stateless message brokers. To implement asynchronous communication, some microservices act as producers and send a message to the message-broker queue. Then, other microservices may consume that message, process it, and send a response back to the microservice that sent the message. The response is then processed by the callback that was set by the requesting microservice. This is how the asynchronous communication between the microservices is established.