Monday, February 18, 2019

Zato Blog: Deploying 700 services a second with one CPU

As of today, anyone building Zato from source will notice a significant decrease in time needed for servers to start and stop - it is now possible for an entire server to boot up to a fully functional state in less than two seconds and to shut down in half a second.

The changes in startup time were possible thanks to modifications to how services are deployed - deploying 700 services a second using just one CPU is now feasible, as in the snippet below.

Note that it means services that are actually ready to accept and process incoming messages, in this particular case there were almost 600 internal services and 100+ user-defined ones.

It is easiest to observe it when a server is started in foreground, using the --fg switch; after the initial messages comes the part when the server deploys all of its services, in this case it took roughly 0.9 s.

$ zato start ./server1 --fg
2019-02-18 11:36:07,394 - Starting gunicorn 19.9.0
2019-02-18 11:36:07,396 - Listening at: http://0.0.0.0:17010 (4640)
2019-02-18 11:36:07,396 - Using worker: gevent
2019-02-18 11:36:07,398 - Booting worker with pid: 4662

2019-02-18 11:36:08,462 - Deploying cached internal services (server1)
2019-02-18 11:36:09,229 - Deployed 558 cached internal services (server1)
2019-02-18 11:36:09,230 - Deploying user-defined services (server1)
2019-02-18 11:36:09,365 - Deployed 122 user-defined services  (server1)

Similarly, to stop a server, a fraction of a second is needed. Here, below, the server was running in foreground so Ctrl-C sufficed to stop it - and it took 0.3 s for it to shut down.

^C
2019-02-18 11:46:22,060 - gunicorn.main:271 - Handling signal: int
2019-02-18 11:46:22,060 - Closing IPC (/pubsub/pid)
2019-02-18 11:46:22,061 - Closing IPC (/connector/config)
2019-02-18 11:46:22,075 - Stopping server process (server1:4662) (4662)
2019-02-18 11:46:22,163 - Process exiting (pid: 4662)
2019-02-18 11:46:22,361 - Shutting down: Main

All of it will be released in June 2019, as part of Zato 3.1, and today - one can simply install Zato from source and take advantage of the improvements already.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...