📜 ⬆️ ⬇️

Moscow Django MeetUp Report No. 25



On February 10, the anniversary 25th Moscow Django Meetup was held at the Media Center of IIDF (Internet Initiatives Development Fund) on Serebryanicheskaya Embankment. This is a monthly meeting of Django-developers. Each meeting, several people make presentations to the public, one way or another connected with web development, Python and Django.

Briefly about the fund itself. IIDF helps online startups in the early stages of development. The foundation has already launched its first start-up accelerator in Moscow and is going to hold several sets a year later. IIDF will also open accelerators in other cities in the near future. The priorities of the IIDF are to support educational and infrastructure projects that contribute to the development of a full-fledged market for small and medium Internet businesses in Russia.



"Either Docker or Alcohol"


There were two presentations on the agenda, the first of which was dedicated to Docker, the most actively developing open-source project in the past year. According to speaker Alexander Chistyakov, chief engineer of consulting company Git In Sky, the new way of OS virtualization makes life easier during the development of web applications. With his help, Git In Sky strives to improve its efficiency in managing customer infrastructure.
')
Before Docker, there were several generations of virtualization technology and servers. The most famous of them are XEN, KVM, LinuxV-server, OpenVZ, LXC.



Docker used to use LXC before, but then they invented their own tool - libcontainer. Now Docker can use other backends - Libvirt, LXC, systemd-nspawn and others. Docker containers work according to a rather old dependency injection scheme, that is, the container does not know anything about the environment (a purely programmer thought, a sysadmin would not do that).

The platform is designed to run applications in separate containers, largely changing the configuration of servers, their support and the principle of application deployment. Docker can help develop and deploy web applications and services. Containers are used to divide the application architecture into smaller parts (micro services). The software remains isolated from the base system. This allows for greater acceleration and parallel execution. It is important that docker images are described through declarative dockerfile and are inherited from a single ancestor. Containers are self-sufficient and can be transferred without changes from one server to another or, for example, to the cloud. Developers can sleep peacefully by wrapping the application once, you don’t need to worry that the application will not run on another machine. Containers are designed to run on any server in the last working, tested configuration. So, now, system administrators will have far fewer headaches due to the support of the software.

Docker is supported by Linux distributions with kernel version 3.8 and higher on many different platforms. In other words, this means that you can deploy a containerized application on any Linux machine from a laptop to Amazon Elastic Compute Cloud. According to speaker Alexander Chistyakov, chief engineer of consulting company Git In Sky, the new way of OS virtualization makes life easier during the development of web applications. As the speaker himself said, Docker is both a mushroom and a radio wave. With this reference, he led Docker to solve a number of tasks:
  • Automation of packing and unfolding applications;
  • Scaling web services, databases and backend component;
  • The possibility of continuous integration and deployment on the combat server;
  • Provides services in the background, for example, PostgreSQL;
  • Publish custom images to a private repository or to hub.docker.com (There are a lot of complaints that the hub is unstable);
  • Creating images of virtual machines (containers).

Docker is used as a means of hiding network abstraction (containers work with the network is abstracted; you may not even know what your container's ip is).

Keep in mind that if you restart Docker, all containers will fall.

Github
Official site

Docker Ecosystem


Project Atomic from Red Hat engineers integrates the tools and application container structures with deployment services, which makes it possible to more efficiently manage the container deployment process. Project Atomic allows you to make atomic system upgrades (rpm-ostree). Available for Fedora, CentOS, and Red Hat Enterprise.

Github
Official site


The Consul system from Mitchell Hashimoto, the author of Vagrant, written in Go, is generally a tool for setting up services in the infrastructure. It supports work with several data centers out of the box. With Consul, applications can use a hierarchical key-value store.

With Consul, you can automate the distribution of containers by host and the order in which they start, register services and find them, use it as a means of emulating DNS for containers.

Github
Official site


Alexey Kinev continued the meeting with his report on Tornado high-performance web server.



Tornado is a non-blocking, widely scalable web server that provides the developer with a set of tools. The framework's applications are a regular web.py file (also known as the Google web application), but they have access to a number of additional tools that increase efficiency and reveal the potential of a long-term session infrastructure of the platform.

Alexey shared his vision of the Tornado framework, with which he has been working since 2012. The speaker proposed to compare Tornado and Django, which, frankly, is not entirely correct. Although both frameworks are used in web development, they still have a different architecture and have historically developed in different directions, as the speaker himself noted. Unlike Django - full stack, Tornado is not very flexible and versatile, but it is made with sharpening speed. The speed is achieved due to the principle of using lengthy request processing (each active user uses an open connection to the server), which makes solid acceleration possible. This allows it to operate with thousands of one-time connections, which means that the framework is well suited for creating real-time web services. With proper optimization, Tornado can deliver performance comparable to node.js.

Like Django, Tornado can work with web sockets, supports the MVC pattern. Particular attention was paid to the warnings about a lower-level approach to development and the presence of a strictly defined entry point into the application (in Tornado, the application begins with the Handler design), unlike Django, where there is no such point.

Tornado mainly works with the ioloop module. This module serves the entire operation of the application, tracking changes in the cycle, providing the ability to process the request for a long time. Call backs also come out of this cycle (they come at the level of events in the OS, because they do not create separate threads, which allows you to win in speed).

Summarizing: Tornado is not a replacement for Django. This framework is more suitable for smaller tasks, between which you need to quickly switch.

Often the following moles are used in development: httpserver is an HTTP server, (add-on over the web module), httpclient is an HTTP client (works with httpserver and web modules). Supports long sessions. A Web module that includes the main Tornado functions (RequestHandler and Application classes), template - managing Python syntax templates, as well as goodies, like the escape module (methods responsible for encoding / decoding XHTML, URL, JSON and YAML), locale ( localization) and auth — authentication using OpenID and OAuth schemes.

Github
Official site


Personal impressions


The event took place at the height. The speakers covered a fairly large range of tasks related to the stated topics. It was interesting, the communication took place in a relaxed atmosphere. As expected, discussion and comparison of Django with Tornado caused the greatest interest among the public. The platform goes to a new level, no longer limited to discussing only Python or Django.

The organizers position Django Meetup as a party, where everyone can come and share their work experience, understand what is happening in the industry, get first-hand information (at the 25th meetingup, for example, Sergey Sobko came from RBC who spoke at the 23rd meeting ).

I recommend everyone not to miss such events and try to attend and, if possible, perform. Speaking at such venues is an excellent tool for performing on more serious ones. Excellent experience and many interesting things.

Special thanks to the organizers for their work in collecting and developing the community.

Source: https://habr.com/ru/post/250679/


All Articles