Tech Conference 28.-29.5.2015 Mikropalvelut, Kontit ja Nano Server tulevaisuuden ajoympäristöt? Jouni Heikniemi Offbeat Solutions #TechConfFI
Hei kuka puhuu? Offbeat Solutions 2010 -> konsultti Sininen Meteoriitti 2004 2010 arkkitehti, tuotekehitys, CTO MikroBitti/MBnet 1995 2004 Jouni Heikniemi 040 566 8379 jouni@offbeat.fi @jouniheikniemi redmond-recap.com C#,.NET, projektinhallinta, katselmoinnit, strategia, tietokannat
Agenda Kohti pienempiä, siirtyvämpiä palasia Mitä ovat mikropalvelut ja Service Fabric? Mitä ovat kontit ja Docker? Mikä on Nano Server? 3
Ajoympäristöt muutoksessa: Kohti pienempiä, siirtyvämpiä palasia Tech Conference 2015
.NET Core Tech Conference 2015
.NET Coren palaset Microsoft.CSharp System.Diagnostics.Debug System.IO.FileSystem.Watcher System.Net.WebSockets Microsoft.VisualBasic System.Diagnostics.FileVersionInfo System.IO.MemoryMappedFiles System.ObjectModel Microsoft.Win32.Primitives System.Diagnostics.Process System.IO.Pipes System.Reflection Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.IO.UnmanagedMemoryStream System.Reflection.DispatchProxy Microsoft.Win32.Registry System.Diagnostics.TextWriterTraceListener System.Linq System.Reflection.Emit System.AppContext System.Diagnostics.Tools System.Linq.Expressions System.Reflection.Emit.ILGeneration System.Collections.Concurrent System.Diagnostics.TraceSource System.Linq.Parallel System.Reflection.Emit.Lightweight System.Collections System.Diagnostics.Tracing System.Linq.Queryable System.Reflection.Extensions System.Collections.NonGeneric System.Dynamic.Runtime System.Net.Http System.Reflection.Primitives System.Collections.Specialized System.Globalization.Calendars System.Net.Http.WinHttpHandler System.Reflection.TypeExtensions System.ComponentModel.Annotations System.Globalization System.Net.NameResolution System.Resources.ReaderWriter System.ComponentModel System.Globalization.Extensions System.Net.NetworkInformation System.Resources.ResourceManager System.ComponentModel.EventBasedAsync System.IO.Compression System.Net.Primitives System.Runtime.CompilerServices.VisualC System.ComponentModel.Primitives System.IO.Compression.ZipFile System.Net.Requests System.Runtime System.ComponentModel.TypeConverter System.IO System.Net.Security System.Runtime.Extensions System.Console System.IO.FileSystem.AccessControl System.Net.Sockets System.Runtime.Handles System.Data.Common System.IO.FileSystem System.Net.Utilities System.Runtime.InteropServices System.Data.SqlClient System.IO.FileSystem.DriveInfo System.Net.WebHeaderCollection System.Runtime.InteropServices.WindowsRuntime System.Diagnostics.Contracts System.IO.FileSystem.Primitives System.Net.WebSockets.Client System.Runtime.Loader 6
ASP.NET 5 Linux ASP.NET 5 Mac ASP.NET 5 Windows Server IIS ASP.NET Classic Windows Server Svc ASP.NET 5 IIS ASP.NET 5 7
ASP.NET 5 - muistijälki ASP.NET Classic ASP.NET 5 8
Kohti mikropalveluita: Service Fabric Tech Conference 2015
microservices is a software architecture style, in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs. These services are small, highly decoupled and focus on doing a small task. Tech Conference 2015
Microservices High Availability Simple programming models Hybrid Operations High Density Hyper-Scale Data Partitioning Automated Rollback Rolling Upgrades Service Fabric Low Latency Stateful services Placement Constraints Health Monitoring Fast startup & shutdown Container Orchestration & lifecycle management Load balancing Self-healing Replication & Failover Windows Server Linux Windows Server Linux Azure Hosted Clouds Windows Server Linux Private Clouds
Service Fabric ei mikään uusi juttu Azure DocumentDB Intune Azure SQL Database Cortana Bing Skype for Business Event Hubs 12
Kaksi ohjelmointimallia Reliable Services Reliable Actors 13
Reliable Service protected override async Task RunAsync(CancellationToken cancellationtoken) { while (!cancellationtoken.iscancellationrequested) { } // Tee jotain await Task.Delay(TimeSpan.FromSeconds(1), cancellationtoken); } + ReliableDictionary, ReliableQueue 14
Actorit arkkitehtuurimallina An actor is a computational entity that, in response to a message it receives, can concurrently: - send a finite number of messages to other actors; - create a finite number of new actors; - designate the behavior to be used for the next message it receives. 15
Actors public class CounterActor : Actor<CounterState>, ICounterActor { public Task<int> GetCount() { return Task.FromResult(this.State.Count); } } public Task IncrementCount(int by) { this.state.count += by; return Task.FromResult(true); } public interface ICounterActor : IActor { Task<int> GetCount(); Task IncrementCount(int by); } [DataContract] public class CounterState { [DataMember] public int Count; } 16
Actor Client public static void Main(string[] args) { var proxy = ActorProxy.Create<ICounterActor>(new ActorId( esimerkkilaskuri"), "fabric:/actor1application"); proxy.incrementcount(5).wait(); } Console.WriteLine("Count from Actor: {0}", proxy.getcount().result); 17
Actorit arkkitehtuurimallina Jokainen liiketoimintaoliosi voisi olla aktori Mitkä oliot tarvitsee hajauttaa? Mitkä oliot tarvitsevat toisiaan? Minkä olioiden prosessointia on voitava skaalata? 18
Node 100 Node 101 Node 102 Node 103 Node 104 Node 105 P S S S S S P S P S S S S P S S S PS S P S S S
Mitä voin tehdä Service Fabricilla? ASP.NET 5 Reliable Services Reliable Actors 20
Service Fabric missä mennään? Julkisessa previewssä Buildista alkaen http://azure.microsoft.com/en-us/documentation/services/service-fabric/ Tuki Azureen asentamiseen on tulossa PaaS v2 21
Kontit ( containers ) mitä ja miksi? Tech Conference 2015
Virtuaalikoneet vs. kontit Virtuaalikone Sovellus Sovellus Kontti Kontti Kontti Kontti Kontti Kontti OS OS Hypervisor Laitteisto Hypervisor virtualisoi rautaa, BIOSin jne. Konttikerros virtualisoi käyttöjärjestelmän Kontti Kontti Kontti Konttipalvelut OS Laitteisto Perinteiset virtuaalikoneet Konttivirtualisointi Tech Conference 2015
Miksi kontit ovat tehokkaampia? Vähemmän käyttöjärjestelmiä muistissa Jaettu muisti konttien välillä Muistin- ja prosessorin hallinta yli työkuormien Hypervisor ei syö muistia Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Konttipalvelut OS Laitteisto Konttivirtualisointi 24
VMwaren vsphere Resource Management Guidesta 25
Keveys on myös nopeutta Kauanko sovelluskuorman käynnistäminen kestää? Windows Server -virtuaalikone 0 20 40 60 80 100 120 140 160 180 200 26
Keveys on myös nopeutta Kauanko sovelluskuorman käynnistäminen kestää? Windows Server -virtuaalikone Windows Server -kontti 0 20 40 60 80 100 120 140 160 180 200 27
Kerrokselliset imaget Kontti on suorituksessa oleva ajoympäristö. Image on se malli, josta ajoympäristö on muodostettu. 28
Kerrokselliset imaget Kontti Data Muutokset tiedostoihin, rekisteriin ym. IIS Media Services -image IIS-image Windows Server -image 29
Oman imagen muodostaminen Kontti Oma MyApp-sovellus asennettuna IIS Media Services -image IIS-image Windows Server -image 30
Oman imagen muodostaminen Oma MyApp-sovellus asennettuna IIS Media Services -image IIS-image Windows Server -image 31
Oman imagen muodostaminen 12bfa315 : jouniheikniemi/myapp Oma MyApp-sovellus asennettuna Pohjaimage: offbeat/iis-media-services:2.4 IIS Media Services -image IIS-image Windows Server -image 32
Oman imagen muodostaminen 12bfa315 : jouniheikniemi/myapp Oma MyApp-sovellus asennettuna Pohjaimage: offbeat/iis-media-services:2.4 IIS Media Services -image Pohjaimage: microsoft/iis:8.5 IIS-image Pohjaimage: microsoft/ws2016:* Windows Server -image 33
Imaget asuvat varastoissa (repository) Kontti Kontti Kontti Organisaation sisäinen repository: mycorp/taloussofta1 mycorp/custom-mysql mikko/testisovellus-3 Iso Julkinen Repository: microsoft/ws2016 microsoft/iis jetbrains/teamcity Kontti Kontti Kontti Kontti Kontti Kontti Konttipalvelut OS Laitteisto Push Pull 34
Mikä on Docker? Ensimmäinen Isosti levinnyt Linux-toteutus konteista Open source -projekti Standardoitunut työkalusetti konttien hallintaan Microsoftkin kääntynyt tämän taakse 35
Docker Docker Hub Docker-työkalut Docker-työkalut Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti LXC / libcontainer Linux Laitteisto Konttipalvelut Windows Laitteisto 36
Kontit + virtualisointi K K K K Kontti Kontti Kontti K K K K Kontti Kontti Kontti libcontainer Konttipalvelut Kontti Kontti Kontti Linux Windows Kontti Kontti Kontti Hypervisor Konttipalvelut Windows Laitteisto 37
Hyper-V Containers Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Hyper-V Container on normaalia Windows Server Containeria paremmin eristetty (ja enemmän resursseja kuluttava) kontti. Hyper visor Konttipalvelut Windows Laitteisto 38
Kontit: Miksi? Lisää suorituskykyä ja halvemmat konekulut Kätevä asennusmalli Kätevä päivitysmalli 39
Kontit: Missä mennään, mikä aikataulu? Docker Client for Windows on julkaistu Konttituki Windows Serverin seuraavassa previewssä ( kesällä ) Docker-tuki Azureen lienee tulossa jossain vaiheessa 40
Service Fabric + kontit Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Kontti Konttipalvelut OS Laitteisto Service Fabric 41
Nano Server Tech Conference 2015
Uusi, kevyempi Windows Server Vähemmän päivityksiä ja bootteja Pienempi image, suurempi virtuaalikonetiheys Basic Client Experience Server with Local Admin Tools Nano Server Server Core 43
Vähemmän bootteja 25 20 15 10 5 0 Critical Bulletins Nano Server Server Core Full Server 12 10 8 6 4 2 0 Number of Reboots Nano Server Server Core Full Server 44
Pienempi image Disk Footprint (GB) VHD Size (GB) 6 7 5 6 4 3 2 5 4 3 2 1 1 0 0 Nano Server Server Core Nano Server Server Core 45
Rajoitukset Vain tietyt työkuormat Hyper-V, levyjaot, klusterit Core CLR, ASP.NET 5, Service Fabric Ei graafista käyttöliittymää PowerShell DSC, System Center jne. 46
Lopuksi Tech Conference 2015
Koodaa Service Fabricilla ASP.NET 5 Kontti Paketoi kontiksi Pyöritä Nano Serverissä Tech Conference 2015
Vakavasti Service Fabric on tärkeä tietyille sovellustyypeille tuskin maksaa vaivaa useimmissa perussovelluksissa Kontit kaikkien kannattaa opetella sekä prosessi- että ekonomiasyistä Nano Server on kiinnostava, jos olet on-premises muuten nautit siitä vain ilmaiseksi 49
Tech Conference 28.-29.5.2015 Kiitos! Jouni Heikniemi @jouniheikniemi 040 566 8379 bit.ly/suomidevaajat # TechConfFI