5.2. Main components¶
5.2.1. Django¶
https://www.djangoproject.com/
PyScaler is essentially a python web application based on the Django framework.
The core Django MVC framework consists of an object-relational mapper which mediates between data models (defined as Python classes) and a relational database (“Model”); a system for processing requests with a web templating system (“View”) and a regular-expression-based URL dispatcher (“Controller”).
Django applications are structured in project and apps. A Django project is a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings. A Django app is a bundle of Django code, including models and views, that lives together in a single Python package and represents a full Django application.
Django provides a Object-relational Mapping (ORM, O/RM, and O/R mapping) layer that provides an abstraction layer to the underlying database backend. Instead of defining database tables, indexes, relationships, etc..., you define Django models that represent the application data layout. Django ORM supports many different database backends as SQLite, MySql, etc...
5.2.2. Celery¶
Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.
Some common Celery use cases:
- Running something in the background. For example, to finish the web request as soon as possible, then update the users page incrementally.
- Running something after the web request has finished.
- Making sure something is done, by executing it asynchronously and using retries.
- Scheduling periodic work.
As Django is a web application it just executes code when an url is called. As PyScaler needs to execute code on a scheduled basis (performance data collecting, etc...), it relies on Celery scheduling capabilities to automate the code execution. The Celery component that handles the periodics tasks is called Celerybeat.
PyScaler can invoke lengthy operations such as virtual machine deployments, etc... Being PyScaler a web application it is supposed to be responsive and it can not wait a for this lengthy operations to be finished. PyScaler overcome this situation by packaging these lengthy tasks into asynchronous celery task that are executed in the background.
5.2.3. SqLite¶
SqLite is a self-contained, serverless, zero-configuration, transactional SQL database engine.
It is used on PyScaler as the configuration storage. As PyScaler almost configuration storage is minimal and almost not varies, using a simple database as SqLite eases its management.
For big deployments or high availability reasons it could be easily migrated using Django’s ORM layer to another RDMBS as MySql, Oracle, etc...
5.2.4. Memcached¶
Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.
In PyScaler it is used to store the gathered performance data. As it is memory based all queries are really fast and it is easily scalable.
5.2.5. RabbitMQ¶
RabbitMQ is open source message broker software (i.e., message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP) standard.
It is used by Celery to manage the tasks.
5.2.6. Gunicorn¶
The Gunicorn “Green Unicorn” is a Python Web Server Gateway Interface HTTP Server for Unix.
Although Django provides a basic web server for development it is not suitable for production because it is not optimized to handle all types of requests, such as static files, or high loads. Gunicorn is a pre-fork worker model, ported from Ruby’s Unicorn project. The Gunicorn server is broadly compatible with a number of web application frameworks, simply implemented, light on server resources and fairly fast.
5.2.7. Nginx¶
nginx (pronounced “engine x”) is an open source web server and a reverse proxy server for HTTP, SMTP, POP3, and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage.
Nginx is used to serve the required static files and to proxy dynamic request to Gunicorn, where Django is executed.
5.2.8. Puppet¶
Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.
It is used by PyScaler to provision Nodes.
5.2.9. Amazon Web Services¶
Amazon Web Services (abbreviated AWS) is a collection of remote computing services (also called web services) that together make up a cloud computing platform. They are Amazon.com cloud Infraestructure As A Service offering.
PyScaler makes direct use of EC2 (Elastic Compute Cloud) and ELB (Elastic Load Balancer) although it can make use of additional services if needed.