Engaged with ASAB

🇨🇿 Česká verze je níže / Czech version is below.

About microservices, coroutines, failures and enthusiasm. And most of all, about ASAB. These are my first months at TeskaLabs.


A while ago I wrote about joining TeskaLabs. After the first month, when I was learning new things at a rocket speed and picking up basic vocabulary, there came a period I called the lag phase. I just felt like I sucked. I was getting angry all the time, complaining. Because it’s always so lame! Wrong port number, missing configuration, different IP address, old package version, VPN turned off… I often think to myself, at least I won’t do that again. And then, again, I try to run something without config file anyway.

Breaking point

During one workshop, Přemek was describing me a picture with a diagram of Logman. “… at the very bottom there are the technologies it uses. You probably already know them all.” I stopped listening to Přemek for a moment and stared at that row of icons, because I realized at that moment: Wow, I already know them all!

In my two months at Teskalabs, in addition to Prometheus, which you’ve already read about, I also became familiar with ElasticSearch, Kafka, ZooKeeper, and Grafana. I don’t cry because of Docker anymore, I can’t live without Postman, I’ve moved to Linux, and I’m even getting into networks and servers. When I get bored, I play with HTML. And I’m so happy about it! Even though I get blue from time to time, the green bar under my photo on GitHub makes all sorrows disappear.

Most of all, I feel satisfied when I can get the right object in the right place. There are less I can’t install/connect/run it problems to solve. Instead, I have to think more about the relevance of the code I produce. I even started to write my first real microservice! It’s like sculpting a mighty Golem out of the clay. It’s exciting to actively build something, and I credit ASAB for this opportunity to create.

It’s not bullshit, it’s coroutine

ASAB is the first thing that probably every newcomer to TeskaLabs gets fond of. Since everything is soaked with it, I slowly started to unveil one service of this tool after another. And yet, there is always that awkward and uneven learning curve; it took me over a month to discover, over a beer, that ASAB is a framework. (As if I heard Aleš saying, “Eliška, you don’t read the documentation!”) So for the record, ASAB (Asynchronous Server Application Boilerplate) is an opensource asynchronous framework.

ASAB provides the functionality that is needed by every microservice. Typically, it is a webserver with a REST API or WebSocket connection. This communication relies on the aiohttp library, which documentation has with a little exaggeration become my homepage. ASAB also handles other vital functions such as logging, configuration or authorization. There are also less essential functionalities, but typically beneficial for all applications. Yes, I’m talking about my beloved metrics.

“It doesn’t work.”
“What’s not working?”
“Some asynchronous bullshit.”
“Eliška, it’s not bullshit, it’s coroutine.”

The heart of the ASAB is an asynchronous loop. The main point of this framework is to allow even a greenhorn like me to create a fully asynchronous application. ASAB handles this asynchronous loop, connects individual parts of the application to it, and supplies the tools to solve the asynchronous puzzles. I had to adopt a whole new way of thinking about such code, and further, to accept that before one coroutine is executed, many other asynchronous tasks might be launched in the application life-cycle. However, in time of need, ASAB can help, for example with its TaskService, which gracefully takes care of the so-called “fire-and-forget” coroutines.

I could keep on talking about ASAB. And I certainly will again, but I challenge you to take it beyond this story—start exploring! I’d like to challenge all small and big Python enthusiasts who search for a fast and simple tool for input/output processes. I’d like to appeal to all Python beginners who want to build their first application. Try ASAB! All you need to do is pip install asab.
Přemek’s videos can guide you through the first steps. Or chat with my cute animals. And now, as I recommend that you visit the documentation page, maybe even I will become a better person and start reading the documentation myself before panicking.

🇨🇿 ASAB mi přirostl k srdci

O mikroslužbách, korutinách, o failech i nadšení. A hlavně o ASABu. To jsou mé první měsíce v TeskaLabs.


Před nějakou dobou jsem psala o svém nástupu do TeskaLabs. Po prvním měsíci, kdy jsem se učila nové věci raketovým tempem a osvojovala si základní slovíčka, přišlo období, které jsem nazvala lag fází. Měla jsem pocit, že mi nic nejde. Rozčilovala jsem se, nadávala. Protože vždycky je to taková blbost! Špatné číslo portu, chybějící konfigurace, jiná IP adresa, stará verze package, vypnutá VPN…. Často si říkám, že aspoň už takovou blbost podruhé neudělám. A pak se stejně znovu snažím pustit něco bez configu.

Bod zlomu

Při jednom workshopu mi Přemek popisoval obrázek, na kterém bylo schéma Logmana. „… úplně dole jsou technologie, které využívá. Ty už asi všechny znáš.“ Na chvilku jsem Přemka přestala poslouchat a zírala na tu řádku ikon, protože jsem si v tu chvíli uvědomila: Tyjo, vždyť já už všechny znám!

Za dva měsíce v Teskalabs jsem vedle Promethea, o kterém jsem již psala, poznala také ElasticSearch, Kafku, ZooKeeper a Grafanu. Kvůli Dockeru už nepláču, bez Postmana nedám ani ránu, přešla jsem na Linux, a dokonce pronikám do sítí a tunelů serverů. Když už mě to všechno přestane bavit, tak si hraji s HTML. Mám z toho radost! A když mě přece jen ještě někdy přepadnou chmury, zaručeně je dokáže zaplašit zelenající se lišta pod mou fotkou na GitHubu.

Ze všeho nejvíc mě těší, že občas dokážu dostat správný objekt na správné místo. Řeším méně problémů typu „nejde mi to nainstalovat, připojit, rozběhat‟ a více se musím zamýšlet nad smysluplností a použitelností kódu, který tvořím. Dokonce začínám psát svoji první opravdickou mikroslužbu! Je to jako plácat z hlíny mocného Golema. Je úžasné, že mohu něco aktivně vytvářet, a za tuto možnost tvořit vděčím ASABu.

To nejsou blbiny, ale korutiny

ASAB je první věc, která asi každému nováčkovi v TeskaLabs přiroste k srdci. Protože je jím prosyceno úplně všechno, začala jsem pomalu rozkrývat jednu službu tohoto nástroje po druhé. Nicméně to, že ASAB je framework, jsem se dozvěděla až po více než měsíci u piva. (Jako bych slyšela Aleše říkat: „Eliško, ty nečteš dokumentaci!‟) Takže pro pořádek: ASAB (Asynchronous Server Application Boilerplate) je opensource asynchronní framework.

ASAB zajišťuje základní funcionality, které potřebuje každá mikroslužba. Typicky tedy webserver s REST API nebo WebSocket spojením. Tato komunikace se opírá o knihovnu aiohttp, jejíž dokumentace se s trochou nadsázky stala mou domovskou stránkou. ASAB také řeší další vitální funkce jako jsou logování, konfigurace nebo autorizace. Najdou se zde i méně nezbytné funkcionality, které ale typicky prosycují všechny aplikace. Ano, mluvím o svých oblíbených metrikách.

„Nefunguje to.‟
„Co ti nefunguje?‟
„Nějaký asynchronní blbiny.‟
„Eliško, to nejsou blbiny, ale korutiny.‟

Srdcem ASABu je smyčka, asynchronní „loop‟. Hlavním smyslem tohoto frameworku je umožnit i začátečníkovi, jako jsem já, vytvořit plně asynchronní aplikaci. ASAB obsluhuje tuto asynchronní smyčku, napojuje do ní jednotlivé části aplikace a dodává nástroje k rozlousknutí asynchronních oříšků. Musela jsem si osvojit zcela nový způsob uvažování nad takovým kódem a přijmout, že než se vykoná jedna korutina, může se v životním běhu aplikace spustit mnoho jiných asynchronních úkolů. V nebezpečných chvílích ale umí ASAB přispěchat na pomoc třeba se svou TaskService, která se elegantně postará o tzv. “fire-and-forget” korutiny.

O ASABu bych mohla vyprávět zaníceně dál. A jistě ještě budu, ale nenechte si to jen vyprávět – pusťte se do objevování! Chtěla bych vyzvat všechny malé i velké Python nadšence, kteří hledají rychlý a jednoduchý nástroj pro input/output procesy. Chtěla bych oslovit všechny Python začátečníky, kteří si chtějí postavit první aplikaci. Zkuste ASAB! Stačí k tomu jediné: pip install asab.
Prvními kroky vás mohou provést Přemkova videa. Nebo si pokecejte s mými zvířátky. A když vám teď poradím navštívit stránku s dokumentací, třeba se i já polepším a začnu dřív číst dokumentaci než propadat panice.

About the Author

Eliška Novotná

Junior backend developer at TeskaLabs. Python and unicorns lover.




You Might Be Interested in Reading These Articles

What’s The Difference Between Seacat and VPN?

One of the most common questions people asked us is if SeaCat some kind of a VPN? It's not. Virtual Private Network (VPN) extends a private network across a public network, providing secure connectivity from/to a mobile device. Every application on this device, thus now has access to the private network through the channel opened by VPN. This is safe up to a certain level because it is almost impossible to ensure the integrity of every application on the devices. Especially now when there are apps for everything, and users can download them from Google Play and the Apple store.

Continue reading ...

tech

Published on November 25, 2014

Situations Where Mobile App Security Best Practices is Necessary

The use of mobile app security best practices has become a necessity as app development and mobile usage continue to grow. These practices are needed to improve consumer protection, trust, and regulatory compliance.

Continue reading ...

security development

Published on March 24, 2015

The Birth of Application Server Boilerplate

One of the most exciting tasks for our team in the last month was to create a new application server “boilerplate” that would be used as a basis for most of our growing data-processing products, as well as for other people and companies ...

Continue reading ...

tutorial development asab

Published on January 16, 2018