Feb 25, 2016

Docker ja konttiteknologiat – ratkaisuja ja suorituskykyä

5DM_2466-Edit_blog.jpg

Better_Tech_Blog_intro_banner.jpg

[in English below] Virtualisoinnin käyttö on kasvanut merkittävästi viimeisten vuosien aikana, kun pilvipalveluiden määrä on noussut räjähdysmäisesti ja niin käyttäjien kuin yritystenkin tarpeet ovat kasvaneet tasaisesti. Virtuaalikoneet ovat olleet pilvipalveluiden ja tuotantoympäristöjen selkäranka, mutta nyt konttiteknologiat mahdollistavat kevyemmät ratkaisut virtualisointiin. Kontit käyttävät huomattavasti vähemmän resursseja ja aikaa kuin tavanomainen virtualisointi. Myös Landis+Gyrillä Jyväskylässä konttiteknologioiden hyödyt on tunnistettu ja nykyisin Dockeria käytetään tuotantoympäristöissämme yhä enemmän.

Docker on avoimen alustan sovellus, joka pystyy pakkaamaan sovelluksen kaikkien tarvittavien riippuvuuksien kanssa yhteen virtuaaliseen pakettiin, eli konttiin. Tätä teknologiaa kutsutaan konttiteknologiaksi. Näitä kontteja ohjelmistokehittäjät ja järjestelmäasiantuntijat voivat rakentaa, lähettää ja ajaa helposti hajautettujen järjestelmien sisällä.

Want to know more about working for Landis+Gyr? Just click.

Teknologia tuo valtavia etuja yrityksille uudenlaisen siirrettävyyden, skaalautuvuuden, nopeuden, jakamisen ja ylläpidon muodossa.Yksinkertaistettuna Dockerin kontit ovat ajossa olevia Docker-kuvia (engl. image). Kuvat ovat valmiiksi rakennettuja ja helposti siirrettäviä, stabiileita perusyksiköitä. Yhdestä kuvasta voi olla useampi kontti ja kyseiset kontit koostuvat yhdestä peruskuvasta. Konttien rakentaminen on yksinkertaistettu skriptipohjaisella Dockerfiles’lla, jonka avulla rakennusprosessi voidaan automatisoida.

Hienointa Dockerin buildeissa on kuitenkin se, että kaikkia osia ei käännetä, vaan pelkästään muuttuneet osat päivittyvät, mikä antaa entisestään lisää nopeutta prosessille. Docker ei ole pelkästään parempi resurssien käytössä, mutta se on myös eräällä tavalla “järjestelmä” sovelluksien pakkaamiseen.

Mitä ongelmia Dockerilla voidaan siis ratkaista ja mitä hyötyä siitä on?

Ohjelmistoalaa on jo pitkään vaivannut moninainen ongelma ohjelmistojen riippuvuuksien kanssa, eli “dependency hell”, joka voidaan nyt ratkaista kokonaan Dockerilla. Konteilla on valmiina kaikki tarvittavat riippuvuudet ja jos Docker-kuva ei ole viallisesti rakennettu, kyseinen kontti toimii varmasti kaikissa Dockerin alustoissa. Tämän lisäksi Dockerilla on monia muitakin hyötyjä:

  • Helppo siirrettävyys

    Kontit ovat helppoja siirrettäviä pienen kokonsa ja standardisoidun yksikkönsä vuoksi eikä siirtäminen häiritse konttien suorituskykyä tai itse konttia millään tavalla.

  • Ripeä jakelu

    Dockerilla on standardisoitu konttiformaatti, joten ohjelmistotiimien ei tarvitse murehtia toistensa työtehtävistä, vaan kehittäjät voivat keskittyä konttien sisällä oleviin sovelluksiin ja niiden vaatimiin muutoksiin ja operaattorit puolestaan voivat keskittyä asennuksiin toimiviksi todetuilla konteilla. Jos kontit ja niiden sisältämät paketit on testattu ja ne sisältävät kaikki tarvittavat riippuvuudet, ne toimivat kaikilla Dockerin alustoilla.

  • Skaalautuvuus

    Käyttäjät voivat siirrellä kontteja helposti paikasta toiseen, eli esimerkiksi pilvestä koneelle ja takaisin pilveen ilman ongelmia. Tämän lisäksi skaalaus ylös- ja alaspäin on mahdollista jopa yhdestä tuhansiin ja takaisin tuhansista yhteen.

  • Nopeammat rakennusajat

    Kontit ovat luonnostaan erittäin pieniä ja siten rakentuvat hyvin nopeasti. Tämä mahdollistaa nopeamman testauksen, kehityksen ja käyttöönoton. Kontin rakentamisen jälkeen se voidaan lähettää suoraan testattavaksi ja sen jälkeen suoraan kaikille muille kohteille.

  • Tiheämpi ja tehokkaampi

    Koska Dockerin kontit eivät käytä tavanomaisen virtualisoinnin hypervisoria, voidaan saatavilla olevat resurssit käyttää entistä tehokkaammin. Tämä tarkoittaa yksinkertaisesti sitä, että yhdellä koneella voi olla useampi kontti ja vaikka kone täyttyisi konteista, kevyet Docker kontit ovat silti suorituskyvyltään vähintäänkin yhdenvertaisia ja yleensä parempia kuin tavanomainen virtualisointi.

Nopeammat ja toimintavarmimmat ratkaisut parantavat luonnollisesti tehokkuutta, mutta tämän lisäksi ne mahdollistavat paremman työssä viihtymisen, kun aikaa ei tarvitse käyttää ylimääräiseen näpertelyyn, vaan voidaan keskittyä olennaiseen työhön.

Ohjelmistoalaa on myös vaivannut tuotantoympäristön ylläpito-ongelmat. Vaikka työkaluina käytettäisiin Chefiä tai Puppetia, ovat päivitykset tällöinkin riesa. Tämän lisäksi kasvava servereiden ja sovelluksien määrä lukuisine muutoksineen ja konfigurointitarpeineen muuttavat alati jo valmiiksi kompleksista kokonaisuutta, joka teoriassa voi toimia iäti, mutta jossa käytännössä pienetkin muutokset aiheuttavat ongelmia. Dockerin mahdollistamalla ympäristöllä ei ole enää tarpeen tehdän “pieniä fiksejä”, jotka ovatkin lopulta jotain aivan muuta.

Dockerin ratkaisu on yksi kontti, joka voidaan jakaa nopeasti kaikkiin kohteisiin testauksesta tuotantoon. Hienointa on se, että ohjelmistokehittäjän näpeistä lähtenyt kontti toimii täsmälleen samalla tavalla kaikissa muissakin ympäristöissä ja jos nyt kuitenkin tapahtuu virhetilanne, voidaan se toistaa saumattomasti ja erittäin nopeasti missä tahansa ympäristössä.

Myös automaatiotestaus pääsee aivan eri sfääreihin Dockerin avulla, sillä nyt testiparallellisaatio on vihdoinkin saavuttamassa huipennuksensa. Kuvitellaan tuttu tilanne, jossa testiserverillä ajetaan tuhansien testien sarjaa tietyssä järjestyksessä tietokantaa vasten, jotta testit eivät häiritsisi toisiaan. Kaikki tämä kestää testeistä riippuen - noh, hyvin kauan. Mikä sitten ratkaisuksi? Dockerilla voidaan luoda testien tarpeita vastaava määrä tietokantakontteja, jotta testejä voidaan ajaa valtava määrä rinnakkain kyseisiä tietokantoja vasten. Ja kauanko yhden tietokantakontin käynnistämiseen menee aikaa? Vastaus: pari sekuntia.

Ylipäätään Docker ja muut konttiteknologiat ovat erittäin lupaavia, ja niitä täytyy pitää tavanomaisen virtualisoinnin korvaajana aivan lähitulevaisuudessa. Dockerilla on jo paljon hienoja ominaisuuksia ja niin paljon keskustelua herättäneisiin tietoturvaongelmiin kuin hajautettujen järjestelmien vaatimaan klusterointiinkin on kehitetty toimivia ratkaisuja. Loppukaneettina ja kehoituksena lukijoille: Tutustu Dockeriin, sillä virtualisointi ei ole katoamassa minnekään ja Docker on tullut jäädäkseen.

 

Docker and container technologies
– solutions and performance

The use of virtualization has grown drastically in recent years along with the explosion in cloud services, and the needs of both users and companies have risen steadily. Virtual machines have been the backbone of cloud services and production environments, but now container technologies enable the use of more lightweight virtualization solutions, as containers consume way less resources and time than conventional virtualization. At Landis+Gyr in Jyväskylä we have also identified the benefits of container technologies and are increasingly using Docker in our production environments.

Docker is an open platform software capable of packaging an application with all of its dependencies into a single virtual package called container. This technology is referred to as container technology. Software developers and operators can easily build, ship and run these containers within distributed systems. This technology provides companies with huge benefits, as it brings new levels of portability, scalability, speed, sharing and maintenance.

Want to know more about working for Landis+Gyr? Just click.

In simple terms, Docker containers are Docker images that are being run. The images areready-built, easily portable and stable basic units. There can be several containers for one image and these containers consist of one basic image. Container building has also been simplified through script-based Dockerfiles which make it possible to automate the building process. The most brilliant thing about Docker builds is that not all parts are compiled; instead, only the changed parts are updated, which further speeds up the process. Docker is not only better in terms of resource use; it is also a sort of ‘system’ for packaging applications.

So, what problems can be solved with Docker and what are its benefits?

 The software industry has long been plagued by the problem of software dependencies, the ‘dependency hell’, which can now be solved using Docker. All the necessary dependencies are present in the containers, and unless the Docker image is incorrectly built, the container is guaranteed to run on any Docker platform. In addition, Docker has a number of other benefits:
  • Portability

    Thanks to their compact size and their standardized unit, the containers are easily portable without interfering with the containers or their performance in any way.

  • Fast sharing

    Docker uses a standardized container format, which means that software teams do not need to worry about each others’ work tasks; instead, developers can fully concentrate on the applications inside the containers and the changes required by them, while operators can focus entirely on installations using tried and tested containers. Once the containers and the packages they contain have been tested and include all the necessary dependencies, they will run on any Docker platform.

  • Scalability

    Users can easily move containers from one place to another, for example, from the cloud onto a laptop and back to the cloud without problems. In addition, scaling up and down is easy, it is possible to adjust the scale from one to thousands and back to one.

  • Faster build times

    The containers are inherently very small and thus fast to build. This enables more rapid testing, development and deployment. Once the container has been built it can be shipped straight to testing and thereafter directly to all the other environments.

  • Higher density and better efficiency

    As Docker containers do not use a hypervisor like in conventional virtualization, the available resources can be utilized more efficiently. This simply means that there can be more than one container in a machine, and even if the machine is full of containers, the lightweight Docker containers offer at least the same, and usually a higher, level of performance than conventional virtualization.

Faster and more secure solutions naturally improve efficiency, but they also enhance work satisfaction, as developers and operators can save time by focusing on what is essential.

The software industry has also typically been plagued by maintenance problems in the production environment. Even when using Chef or Puppet, updates are a nuisance. In addition, the growing number of servers and applications with all their changes and necessary configurations alter a system that is already complex as it is. In theory, it could work forever, but in practice, the tiniest of changes can cause issues. Thanks to the environment made possible by Docker, there is no more need to carry out ‘small fixes’ which end up being far from small.

Docker’s solution is one container that can be quickly delivered to all locations from testing to production. The best thing is that the container completed by the software developer will function exactly the same way in all other environments as well, and if an issue occurs, it can be repeated seamlessly and very quickly in any environment.

Automation testing also achieves new heights with Docker, with test parallelization now reaching its culmination. Let’s imagine a familiar situation where a series of thousands of tests is being run on a test server. They must be run in a specific order against the database so that the tests do not to interfere with one another. Depending on the tests, all this will take - well, let’s just say a very long time. What’s the solution? With Docker, the necessary number of database containers can be created so that a huge number of tests can be run in parallel against the databases. And how long does it take again to start up one database container? The answer is a couple of seconds.

All in all, Docker and the other container technologies are highly promising, and they must be seen as a replacement for conventional virtualization in the foreseeable future. Docker already offers a host of amazing features and has developed solutions for both the much-talked-about data security issues and the clusterization required by distributed systems. In conclusion and as an encouragement to our readers: get to know Docker, because virtualization is not going anywhere and Docker is here to stay.

 

Related articles:

No Free Lunch with Distributed Systems

Datavirrat eivät ole rauhallisia jokia, ne virtaavat ryöppyinä

Uudet teknologiat kasvattavat tietotaitoa