44
Nummer 124 februari 2015 SDN Magazine verschijnt elk kwartaal en is een uitgave van Software Development Network www.sdn.nl IN DIT NUMMER O.A.: Remote debugging naar een Azure VM < Decrease dataflows between systems with CDC < SQL Server In-Memory OLTP < SCRUM is meer dan een project management methodologie < SOFTWARE DEVELOPMENT NETWORK MAGAZINE 124 ISSN: 2211-6486

SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

Nummer 124 februari 2015 SDN Magazine verschijnt elk kwartaal en is een uitgave van Software Development Network

www.sdn.nl

IN DIT NUMMER O.A.:

Remote debugging naar een Azure VM <Decrease dataflows between systems with CDC <

SQL Server In-Memory OLTP <SCRUM is meer dan een project management methodologie <

SOFTWARE DEVELOPMENT NETWORK

MAGAZINE

124

ISSN: 2211-6486

Page 3: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

magazine voor software development 3

ColofonUitgave:Software Development NetworkDrieëntwintigste jaargangNo. 124 • februari 2015

Bestuur van SDN:Marcel Meijer, voorzitterRob Suurland, penningmeesterRemi Caron, secretaris

Redactie:Marcel Meijer([email protected])

Aan dit magazine werd meegewerkt door:Roel Hans Bethlehem, Bob Swart, Maartenvan Stam, Arjen Bos, Alexander Meijers,Remi Caron, Marcel Meijer en natuurlijk alleauteurs!

Listings:Zie de website www.sdn.nl voor eventuelesource files uit deze uitgave.

Contact:Software Development NetworkPostbus 506, 7100 AM WinterswijkTel. (085) 21 01 310E-mail: [email protected]

Vormgeving en opmaak:Reclamebureau Bij Dageraad, Winterswijkwww.bijdageraad.nl

©2015 Alle rechten voorbehouden. Niets uitdeze uitgave mag worden overgenomen opwelke wijze dan ook zonder voorafgaandeschriftelijke toestemming van SDN. Tenzijanders vermeld zijn artikelen op persoonlijketitel geschreven en verwoorden zij dus nietnoodzakelijkerwijs de mening van het be-stuur en/of de redactie. Alle in dit magazinegenoemde handelsmerken zijn het eigen-dom van hun respectievelijke eigenaren.

AdverteerdersMicrosoft 2Achmea 44

Adverteren?Informatie over adverteren en de adverten-tietarieven kunt u vinden op www.sdn.nlonder de rubriek Magazine.

voorwoord

Beste SDN Magazine lezer,

Hebben jullie met open mond naar de Windows 10 presentatie zitten kijken? Gezienhoe de opvolger van Windows 8 steeds volwassener wordt en alle plooien er nu weluitstrijkt? Heb je al gespeeld met de volgende versie van Office 2015 welke meer ge-richt is op touch gebruik? Heb je al gekeken naar de nieuwe Visual Studio versie metdaarin allerlei performance meters? Heb je de vele Microsoft applicaties op het An-droid en iOS platform al bekeken? Dat zijn er al ruim 100. In het verleden is Microsoft vaak verweten dat ze een gesloten omgeving waren, hoewel ze als eersteooit voor de MAC applicaties ontwikkelde. Maar tegenwoordig zijn ze nog opener enlaten dat ook graag weten.

In de volgende magazines en events van de SDN komen jullie naast artikelen en sessies van de andere platformen ook verhalen tegen over Microsoft. De SDN is vooralle soorten developers en alle soorten platforms. En dat blijft zo.

Op vrijdag 20 maart is het volgende SDN event. Op dit event zal ook de Algemeneleden vergadering weer plaats vinden. Dit is naast natuurlijk rechtstreeks met mij temailen of ons te bellen, de uitgelezen kans om je als lid van de vereniging te laten informeren en te horen over het reilen en zeilen van de vereniging. Kom dus allemaalen laat je stem spreken.

Dit magazine 124 bevat wederom een uiteenlopende hoeveelheid aan onderwerpen.Over Dynamics CRM, Remote debugging op Azure, Application Insights deel 2, CDCwat is de zin en onzin hiervan, Azure Webjobs, Microservices een mooie verhandeling, de ELK stack wat is het, In-Memory OLTP databases, SCRUM isbruikbaar in meerdere onderdelen van een organisatie, de Delphi's REST Client Library, Microsoft Test Manager beschrijving en nog een paar kleine tips en tricks.Kortom, Bas van de Sande, Cary Jensen, Eric Tummers, Hassan Fadili, Jeffrey Verheul, Marcel Meijer, Patrick Kalkman, Peter ter Braake. Piet Willem Overvoorde,Sander Hoogendoorn en Wouter de Kort hebben weer veel tijd gestoken in dezestuk voor stuk mooie verhalen. Speciaal voor jullie als SDN magazine lezer.

Het volgende magazine 125 maken we iets specialer. Daarover later meer.Heel veel leesplezier en tot 20 maart bij de ALV.

Groeten,Marcel Meijer eindredacteur Magazine en Voorzitter SDN •

Page 4: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

Inhoud03 VoorwoordMarcel Meijer

04 Inhoudsopgave

04 Agenda

05 Microsoft Dynamics CRMBas van de Sande

08 Remote debugging naar een Azure VM Eric Tummers

10 Application Insights for Visual Studio Online (Part 2)

Hassan Fadili

15 Decrease dataflows between systems with CDC

Jeffrey Verheul

17 Azure WebjobsMarcel Meijer

19 Microservices. The good, the bad and the ugly

Sander Hoogendoorn

23 Improving traceability of distributed systems using the ELK stack

Patrick Kalkman

30 SQL Server In-Memory OLTPPeter ter Braake

32 SCRUM is veel meer dan een project management methodologie

Piet Willem Overvoorde

36 Delphi's REST Debugger and REST Client Library, Part 1

Cary Jensen

41 Ken jij Microsoft Test Manager?Wouter de Kort

43 API ManagementMarcel Meijer

• 16-19 maart 2015Microsoft Convergence 2015 Atlanta

• 20 maartSDN event, Zeist

• 29 april - 1 mei//Build San Francisco

• 4-8 mei Microsoft IgniteChicago at McCormick Place

• 12-13 mei Techorama Belgium 2015

• 28-29 mei TechDays, Den Haag

• 12 juni SDN event

• 12-16 juliWorldwide Partner ConferenceOrlando

• 18 september SDN event

Agenda 2015

Page 5: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL Bas van de Sande

GeschiedenisDe eerste versie van Microsoft Dynamics CRM is uitgebracht in 2003.Microsoft was in die tijd bezig met het opkopen van een aantal spelers in de ERP en boekhoudmarkt (o.a. Great Plains, Navision) omzo een positie in de Enterprise markt te verwerven. De CRM, ERP enboekhoudproducten zijn later ondergebracht onder de noemer Microsoft Dynamics, te weten AX (ERP), NAV (boekhouding) en uiteraard CRM. Op dit moment is CRM 2015 net beschikbaar gekomen. Naast de on-premise versie is CRM ook verkrijgbaar alsCRM Online.

Wat is CRM?CRM staat voor Customer Relationship Management, oftewel het beheren van de relatie tussen een klant en een organisatie. Elke klantrelatie kent een levensduur die uit een aantal fases bestaat. De inzet van CRM is er opgericht om de klant in iedere fase van de relatie optimaal te kunnen bedienen om zo een maximaal rendementuit de relatie te halen. Maar niet iedereen die een relatie met een organisatie of bedrijf onderhoudt, is per definitie een ‘customer’. Je kan bijvoorbeeld lidvan zijn van een vereniging, deelnemer aan een community, donateurvan een goed doel, student bij een opleidingsinstituut of juist leve-rancier aan een bedrijf.

De ‘C’ in CRM moet je dus ruim zien en de essentie van CRM is hetoptimaal bedienen van de relatie tussen een persoon of organisatie enjouw organisatie. De ‘C’ moet je dan eigenlijk ook zien als een ‘x’,waarbij de ‘x’ staat voor de andere partij.Als ontwikkelaar moet je er altijd rekening mee houden dat CRM wordtingezet om te voorzien in een functionele behoefte. CRM wordt, in tegenstelling tot andere softwareproducten, niet vanuit de IT-afdelinggepusht, maar juist geïnitieerd voor en/of door de gebruiker; vaakwerkzaam op de klantgerichte afdelingen binnen het bedrijf (marke-ting, verkoop, ledenadministratie, klantenservice). Binnen CRM zijnde klantgegevens, en wat de organisatie wil met die klantgegevens leidend, de technologie is volgend.

In projecten betekent dit dat oplossingen grotendeels door functio-nele consultants in samenwerking met de gebruikers in elkaar wordengezet. Daar waar nodig mogen wij - ontwikkelaars - bijspringen omde complexe onderdelen, rapportages, integraties te ontwikkelen enom de gebouwde oplossing in de vorm van een solution uit te rollen.

Microsoft Dynamics CRM“A journey of a SharePoint developer into the world of CRM”Na jarenlang software ontwikkeld te hebben in C#, SQL Server, BizTalk en SharePoint ben ik onlangs overgestapt op het Microsoft Dynamics CRM platform. In deze serie artikelen wil ik mijn ervaringen delen en jullie enthousiast maken voor dit relatief onbekende platform.In dit artikel beschrijf ik in hoofdlijnen wat CRM inhoudt en waarom de ‘C’ van CRM eigenlijkeen ‘x’ hoort te zijn. Ten slotte werp ik een eerste blik onder de motorkap van Microsoft Dynamics CRM.

Microsoft Dynamics CRMNet zoals bijvoorbeeld SharePoint is ook Microsoft Dynamics CRMbeschikbaar als een on-premise versie (CRM 2013/2015) en onlineals CRM Online. Echter, in tegenstelling tot SharePoint lopen de on-premise en de online versie van CRM voor de ontwikkelaar niet veruitelkaar en kun je de technieken die je gebruikt voor je on-premise oplossing gemakkelijk naar de online versie brengen. Zowel de on-premise als de online versie bieden een goede ondersteuning voormobiele devices (iOS, Android en Windows Phone).Microsoft Dynamics CRM integreert nagenoeg naadloos binnen deOffice suite (add-in voor Outlook) en leunt technologisch zwaar op de SQL Server database, SQL Server Reporting Services, Internet Information Server en het Microsoft.Net framework (sandbox). Kortom,alle bouwstenen voor een solide applicatieplatform zijn hiermee voorhanden. Zowel de on-premise als de online versie van CRM ziet er in hoofd lijnenals volgt uit:

Fig. 1: schematische weergave opbouw Microsoft Dynamics CRM

De business functionaliteit van Microsoft Dynamics CRM wordt ontsloten door middel van een .NET API. Daarbovenop is een web

magazine voor software development 5

Page 6: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

MAGAZINE

6

van de solution worden aanpassingen binnen de database gemaakt,hierbij wordt de oorspronkelijke structuur met rust gelaten. Wanneer je met bijvoorbeeld SQL Server Management Studio naar dedatabase kijkt, zie je dat van een bepaalde entiteit (bijvoorbeeld Account) meerdere tabellen bestaan. Wanneer je de geïnstalleerde solution verwijdert, dan zullen eventuele aangemaakte tabellen of relaties verdwijnen.Het solution mechanisme van Microsoft Dynamics CRM is erg krachtig en ook gemakkelijk in het gebruik. Je hoeft geen ingewik-kelde provisioning te bouwen en je kunt de solution letterlijk in elkaarklikken.Solutions die zijn gemaakt op één omgeving kan je exporteren,zodat je deze op een andere omgeving kan importeren en uitrollen.Dit mechanisme leent zich uitstekend voor een OTAP straat.

AutorisatieNet als ieder server platform, maakt ook Microsoft Dynamics CRM gebruik van autorisatie. Hierin gaat Microsoft Dynamics CRM erg ver- terecht trouwens, want je werkt vaak met erg gevoelige informatie. De data die in CRM is opgeslagen, wordt beschermd door middel vaneen zeer uitgebreide autorisatiematrix (door een beheerder instelbaar).

API geplaatst waarmee allerlei client applicaties verbinding kunnenmaken. Binnen de formulieren kan gebruik gemaakt worden van javascript om extra functionaliteit te ontsluiten.

The power of SQL ServerDe kern van CRM zijn de SQL Server databases. Een van de data -bases bevat metadata omtrent de configuratie, verder is er nog een content database. Deze database bevat de feitelijke data.Waarin CRM hemelsbreed verschilt ten opzichte van SharePoint, isdat in de CRM data fysieke entiteiten en velden worden aangemaaktwaarin de data wordt opgeslagen. Dit in tegenstelling tot SharePoint,waarbij de database bestaat uit een aantal metatabellen en data -tabellen, waar op basis van de opgeslagen meta-informatie de echtedata kan worden teruggevonden. Hier ligt dan ook echt de kracht vanCRM, namelijk een échte database, met fysieke relaties tussen entiteiten (referentiële integriteit). Het is echter niet de bedoeling dat gegevens rechtstreeks in de database worden aangepast; je zou daarmee een aantal ingesteldebusiness rules kunnen overtreden (constraints). Het aanpassen vande data gebeurt via het objectmodel dat CRM je ter beschikking stelt. Nu vraag je je waarschijnlijk af: “Ja… maar als ik nou niet de regelsovertreed, waarom mag ik dan niet rechtstreeks de tabel-len vullen?”. Dat heeft te maken met de manier waarop Microsoft Dynamics CRM omgaat met aanpassingen op het applicatieplatform.In de online versie is het niet mogelijk om rechtstreeks bij deonderliggende SQL Server databases te komen, waar jenormaal als DBA extra indexen kan leggen om de perfor-mance te verbeteren. In dat geval zal je terug moeten vallen op Microsoft support. Zij kunnen dit voor je doen.

ReportingAls CRM ontwikkelaar werk je normaal gesproken tegenhet objectmodel aan. Echter, in het geval van rapportageswerk je tegen een database view aan die door CRM wordt beheerd.Microsoft Dynamics CRM maakt gebruik van SQLServer Reporting Services. Juist omdat CRM geheel is gebaseerd op data, gebruikt het gelukkig ook de kracht vande onderliggende SQL Server database om query’s uit tevoeren. Je kan dan ook in de datasets die je maakt volledig gebruik maken van de mogelijkheden van Transact SQL. De report definities die uit SSRS voort -komen, kun je later uitrollen via je eigen solution.In de on-line versie kun je geen gebruik maken van SQL query’s, jemoet hier met FetchXML werken. FetchXML is een opXMLgebaseerde querytaal voor Dynamics CRM.

Het werken met solutionsNet zoals Microsoft SharePoint is ook Microsoft DynamicsCRM een applicatieplatform, waarbij ontwikkelaars en gebruikers aanpassingen kunnen maken om zo toepassin-gen te maken die aansluiten op de processen binnen deorganisatie. Binnen Microsoft Dynamics CRM is altijd minimaal één solution geïnstalleerd. Dit is de default solution. Als je wijzingen maakt op de default solution pas je hiermee dekern van CRM aan. De wijzigingen die je uitvoert, kunnenniet met één druk op de knop worden verwijderd.

Om te waarborgen dat je aanpassingen wel ongedaan gemaakt kunnen worden, maak je gebruik van solutions.Binnen de solution wordt van alle objecten die je gaat aanpassen (die je dus toevoegt aan de solution) een kopie gemaakt en met deze kopie ga je aan het werk. Nadat je de wijzigingen hebt doorgevoerd publiceer je dezenaar Microsoft Dynamics CRM toe. Tijdens het publiceren

Fig. 2: voorbeeld autorisatiematrix binnen CRM

Fig. 3: autorisatieniveaus binnen CRM

Page 7: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

In de matrix wordt vastgelegd wie wat mag doen met welke data enwie eigenaar is van welke data. Dit is te vergelijken met item level security binnen SharePoint, maar dan vele malen krachtiger en uitgebreider uitgevoerd.Per gebied, rol, veld en/of entiteit kan worden vastgelegd wie wat metdata mag doen en wie eigenaar is van de data. In onderstaande afbeelding geef ik aan wat de symbolen voorstellen

Binnen CRM modelleer je de organisatie. Een organisatie bestaat uitbusiness units (dit kunnen business units maar ook afdelingen zijn, enkunnen hiërarchisch worden weergegeven). Op het onderste niveaustaat de gebruiker. De autorisatiematrix maakt gebruik van dit principeen de symbooltjes geven aan wie de eigenaar is van de gegevens binnen CRM. Naarmate het bolletje meer is ingekleurd, is er een grotere groep die toegang heeft tot de gegevens. Ogenschijnlijk een eenvoudig te gebruiken mechanisme, maar in depraktijk een van de lastigste onderdelen binnen CRM om te doorgronden.

Ten slotteMijn ervaringen tot zover met Microsoft Dynamics CRM is dat het eenerg krachtig platform is om bedrijfstoepassingen te bouwen waarin relaties tussen organisaties en personen worden onderhouden. Wanneer je gewend bent om te ontwikkelen op een platform als SharePoint zal je aangenaam verrast worden door een aantal zakendie standaard voor je geregeld worden binnen CRM zonder dat je jehiervoor in allerlei bochten hoeft te wringen.

Het prettige aan het ontwikkelen op CRM is dat het eigenlijk niet uitmaakt of je voor de on-premise of voor de online versie ontwikkelt.Het enige verschil dat ik ben tegengekomen zit hem in het moeten gebruiken van FetchXML wanneer je met SQL Server Reporting Services werkt.Microsoft Dynamics CRM is geen wondermiddel; maar wel een goedstuk gereedschap dat je moet inzetten waarvoor het bedoeld is, namelijk het onderhouden van relaties en processen die daarmee gerelateerd zijn. •

Bas van de Sande

Bas van de Sande heeft zich sinds1995 gespecialiseerd in software-ontwikkeling en advisering op hetMicrosoft platform. Hij heeft zichsinds 2005 voornamelijk bezig gehouden met SharePoint en Microsoft.Net. Op dit moment ligtzijn focus op Microsoft CRM enblogt hij zeer actief over zijn

ervaringen met CRM. Bas is werkzaam als Senior Software Developer/Architect bij CRM Partners.

Zoals je op pagina 17 in dit magazine kunt lezen, wordt een Webjob gedeployedbij een Azure website. Bij de Webjob hoort ook een dashboard. Na het deployenvan de Webjob waren er Errors en Warnings over een setting. Zoals de error/warning verteld, moet je de Connectionstring toevoegen aan het Connection stringgedeelte van de Azure website. Daarna is de error/warning weg.

Nu lijkt het net of je deze Connectionstring op twee plekken moest configureren.Een keer op de portal en een keer in de app.config van de Webjob. Dat zou nietmooi zijn, maar dat blijkt ook niet te hoeven.

In je code gebruik je:var storageAccount =

CloudStorageAccount.Parse(

ConfigurationManager.

ConnectionStrings[“AzureWebJobsStorage”].

ConnectionString

);

Maar de Connectionstrings of App settings geef je een waarde op de Configuretab van de Azure Website.

En dit werkt ook voor de App.config van een Azure Webjob.Meer informatie: http://www.asp.net/identity/overview/features-api/best-practi-ces-for-deploying-passwords-and-other-sensitive-data-to-aspnet-and-azure

ConnectionStrings / AppSettings Azure

magazine voor software development 7

Page 8: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

CLOUD Eric Tummers

Debugger extensionVia de Server Explorer in Visual Studio kan de debugger extension opeen Azure VM geïnstalleerd worden. Integratie in Visual Studio maakthet makkelijker om een debug session te starten.

Fig. 1: Remote debugger extension installation

Hiermee worden echter wel drie poorten geopend en dat is een optiedie je mogelijk niet hebt. Dan moet een VPN gebruikt worden en de remote debugging tools.

Virtual NetworkEen best practice is om je VM’s in een virtual network te plaatsen.Hierdoor kunnen machines elkaar makkelijker vinden. Ook bied heteen extra laag van beveiliging, omdat poorten voor interne communicatie niet naar de boze buitenwereld open staan.

VPNAls jouw development machine in hetzelfde network zit, kun je een remote debugging sessie starten. Hiervoor maak je een VPN aan.

Ga naar het virtual network in de azure portal. Open de Configure taben check Configure point-to-site connectivity. Kies daarna eenstarting IP.

Fig. 2: Point-to-site connectivity van virtual network

De sectie eronder zal de melding geven dat een gateway nodig is. Klikadd gateway subnet en wijzig indien nodig het starting IP. Kies Saveen wacht tot alle wijzigingen zijn doorgevoerd.

Fig. 3: Gateway van virtual network

Open een Visual Studio Command prompt en maak een self-signedroot certificate aan. Maak ook een authenticatie certificaat aan voor hetroot certificaat.

Je hebt OTAP met Windows Azure virtual machines ingericht. Deployment gebeurd automatischna een nightly build. Alles is koek-en-ei totdat er een probleem optreedt dat je wil debuggen.Hoe doe je dat in Azure? Installeren van Visual Studio op de VM lijkt de enige optie? GebruikRemote Debugging vanuit je development machine naar een Azure VM.

Remote debugging naar een Azure VM

MAGAZINE

8

Page 9: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

CLOUD

Listing 1: Self-signed root certificate en authenticatie certificaat aanmaken

Upload het root certificaat (MyNetwork.cer) opde Certificates tab. Dit wordt gebruikt om declient VPN te configureren.

Op de Dashboard tab wordt de gateway nouweergegeven als niet aangemaakt. Klik CREATEGATEWAY, dit zal ongeveer 15 minuten duren.Als de gateway aangemaakt is, kun je de ClientVPN Package downloaden en installeren.

Start de VPN in Network Connections van Windows.

Remote debuggingMaak een Remote Desktop connectie naar deAzure VM. Download en installeer de visual studio remote debugging tools van Microsoft. Bijde eerste keer starten van de Remote Debuggermoet deze geconfigureerd worden. Kies configure remote debugging om de defaults tegebruiken. Daarna opent de Remote Debuggeren wacht op connectie van een machine.

Open Visual Studio op de development machine.Ga naar Debug > Attach to Process … Laat hettransport op Default staan. Gebruik bij Qualifierhet IP adres dat bij de machine staat op het vir-tual network dashboard (Figure 3) en de defaultpoort 4018. Log in met dezelfde credentials alsde Remote Desktop.

Selecteer het process en klik Attach. RemoteDebugging naar een Azure VM zonder poortenopen te zetten.

ConclusieMet remote debugging kun je ook in een Azure VM sneller bugs oplossen. OTAP in Windows Azure is de toekomst. De redenen om hetniet te doen worden steeds minder.

LinksRemote debugging tools (http://www.microsoft.com/en-us/download/details.aspx?id=43724)

Debugging a Cloud Service or Virtual Machine in Visual Studio(http://msdn.microsoft.com/en-us/library/azure/ff683670.aspx) •

magazine voor software development 9

Eric Tummers

Eric Tummers is werkzaam als technisch consultant bij Valid enricht zich op kwaliteit in software development. Denk hierbij aan unittesten, build en deployment processen. Bloggen doet Eric voor-namelijk over zijn werk, maar af entoe komt een thuis project erop te

staan, een productiviteit tip of een review. Als het maar bijdraagtaan het sociale internet.In 2015 gaat Eric aan de slag met devops.Daarbij staan powershell en Windows Azure centraal.

Fig. 5: Attach to remote process

Fig. 4: Download client vpn package

makecert -sky exchange -r -n "CN=MyNetwork"

-pe -a sha1 -len 2048 -ss My "MyNetwork.cer"

makecert -n "CN=Developer" -pe -sky exchange

-m 96 -ss My -in "MyNetwork" -is my -a sha1

Page 10: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

.NET /CLOUD

By clicking Add Application Insights To Project, this process starts asshown below (Fig.3) where the NuGet packages needed are installed:

Fig. 3: Adding progress of AI to Project andNuGet packages Install process

Once this step is finished, the ApplicationInsights.config and Web ApplicationI Ovreview filesare added to project as shown below (Fig.4):

Application Insights for Visual Studio Online (Part 2)

To make this concrete, I will walk through the following scenario: “UseApplication Insights to understand application behavior”. To do so, I have split this scenario into the following tasks:• Create MVC Web Application and Add Application Insights to It• Create load / Web tests to simulate the scenarios.• Use App Insights and Load test to validate the assumptions.

To start, an ASP.NET MVC Web Application is created. During this creation, the Application Insights are added to that MVC Web Application as shown below (Fig 1):

Fig. 1: Creation of MVC Web Application with Add Application Insights selected

As part of the Add Applica-tion Insights Process, a re-source MUST be specifiedto send telemetry to. Thiscan be an existing resourceor a new created one asshown below (Fig 2):

Fig. 2: Add Application Insights to Project andspecifying the resource to send telemetry to

Hassan Fadili

In one of the previous SDN Magazines (Magazine 121), I have introduced Application Insightson VSO basics and usage of it on project level and on Visual Studio Online Dashboards. In thisarticle, I will go a step further and explain & show “How Application Insights can help by manyscenarios to get more out telemetry of your Application / Systems?”

MAGAZINE

10

Fig. 4: Added Application Insights Resources to Project

Page 11: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

.NET /CLOUD

Open Application Insights from Visual Studio (Solution Explorer)guides to VSO Dashboard:

Fig. 7: Opening AI from Solution Explorer guides to VSO Dashboard

Because the VSO Dashboard is on Microsoft Azure, the user MUST beauthenticated and authorized to access the specific Azure Instanceby signing to it as shown below (Fig.8):

Fig. 8: Signing to Azure Portal for Accessing Application Insightson Project Level in Microsoft Azure

By Signing into Microsoft Azure Portal with the right credentials (Emailand Password), Microsoft Azure Portal is shown and Application Insights can be added as Tile on this Dashboard as shown below(Fig.9 + Fig.10)

Adding Application Insights to Project from Azure Portal:

Fig. 9: Adding AI to Azure Project Dashboard

Beside the Application Insights Resources added to Project, there arealso some Application Insights References added to the project aswell. This specific references are shown below (Fig.5):

Fig. 5: Application Insights Specific References added to Project

To examine the added ApplicationInsights.config, this can be ope-ned by double click on It. The content of it is shown below (Fig.6):

Application Insights Configuration file content:

Fig. 6: Application Insights Configuration File Content

Once the Add process and examining the Application Insights content on Visual Studio are done, the next step can be to get into Visual Studio Online Dashboard (VSO) to see the Application InsightsInformation in action. This can be done in 2 ways:

• By right click the Web Application Overview file and select OpenApplication Insights (see below Fig.7)

• By double click on the same Web Application Overview file

magazine voor software development 11

Page 12: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

.NET /CLOUD

Adding Application Insights from Azure Portal Futures to Project:

Fig. 10: Adding Application Insights to Project from Azure PortalFutures

To be more specific on this add process, the user MUST specify theWeb Application Information that can be used to be added as shownbelow (Fig.11) like: • Application Name• Application Type• Resource Group• Subscription• Location

Application Information Specifying for Application Insights onthe Azure Portal:

Fig. 11: Application Information to be added for Application In-sights on Azure Portal

When all the necessary information is provided, the user can click onCreate button and creation progress is shown on the Microsoft AzureDashboard as shown below (Fig.12)

Progress of Adding AI to Project on Azure Portal:

Fig. 12: Progress of Adding Application Insights to Project on AzurePortal

From this point, all Application Insights information of a specific WebApplication can be analyzed from the Application Insights Dashboardlike “Events” a shown below (Fig.13): Status of Application Insights Events on Azure Portal after Creation:

Fig. 13: Status of AI Events on Azure portal after Creation

To monitor telemetry for the Web Application, the selected sourcecode below (Fig.14) MUST be added to all pages that must be tracked for Application Insights telemetry like we have done below forIndex.cshtml file:

Adding Source code to all webpages that have to be tracked for Application Insights:

Fig. 14: Code to be added to all Web Pages that have to be trackedfor AI

MAGAZINE

12

Page 13: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

.NET /CLOUD

When all the specific pages are updated with the code above (Fig.14),The Web Application can be compiled and executed. At that mo-ment the first Application Insights Events are sent to Visual StudioOnline Dashboard that is configured as show below (Fig.15)

First Application Insights Events sending to Azure Portal after Adding code to Specific Page(s) that have to be tracked:

Fig. 15: First Application Insights Events sent to Azure Portal afteradding the specific source code to It

Below (Fig.16, Fig.17, Fig.18, Fig.19, Fig.20 ) some specific Applica-tion Insights Information you can track from the Microsoft Azure Portal on Visual Studio Online like: • TimeLine overview• Pages Views• Page Views Charts• Diagnostic Search• ……

Overview TimeLine Information on Azure Portal:

Fig. 16: Overview TimeLine Information on Azure Portal

Usage TimeLine Information on Azure Portal:

Fig. 17: Usage TimeLine Information on Azure Portal

Overview Page Views Information on Azure Portal:

Fig. 18: More Application Insights Info (Page Views) on Azure Dashboard

Overview Page Views Charts Information on Azure Portal:

Fig. 19: Application Insights Page Views Charts Info Configuration

Overview Diagnostic Search Information on Azure Portal:

Fig. 20: Application Insights-Diagnostic Search on Azure Dashboard

Creating Load Test / Web Test for the application and Instrument It:Adding Load / Performance Test Project to Solution for instrumen -tation:

Fig. 21: Adding Web-Performance-Load Test Project

magazine voor software development 13

Page 14: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

.NET /CLOUD

MAGAZINE

14

Running Web Test of AI_WebApplication:

Fig. 22: Running Web Test Status of AI_WebApplication

After you've deployed your web application, you can set up web teststo monitor its availability and responsiveness. Application Insights willsend web requests at regular intervals from points around the world,and can alert you if your application responds slowly or not at all.

Fig. 23: Web Tests Response time (ms)

NB: You can set up web tests for any HTTP endpoint that is accessible from the public internet.

Overview All WebTest Response Information on Azure Portal:

Fig. 24: All Web Test Investigation of Failed Request

Failed tests can be analyzed to determine why they failed. Drill into afailed web test and download and open Visual Studio Web Test Result File to analyze and understand why the test failed.After investigation in Visual Studio by correcting the WebTest errors,the results looks like below on the Microsoft Azure portal (Fig.25):

Conclusion:With the actual Application Insights future in Visual Studio Online, wehave more control on the status of our applications / Systems in termsof investigation when things goes wrong or applications / systems failed.

Hassan Fadili

Hassan Fadili is werkzaam als Free-lance Lead Architect / Consultant enVS ALM Consultant (MVP) voor zijneigen bedrijf FadiliCT Consultancy(http://www.fadilict-consultancy.nl).Hassan is zeer actief in de Commu-nity en mede bestuurslid van DotNed (.NET & VS ALM UG NL) enVS ALM Track Owner. Hassan

houdt zijn blog op: http://hassanfad001. blogspot.com en te bereiken via: [email protected], [email protected], hassanfad11 @hotmail.com en/of via Twitter op: @HassanFad

Fig. 25: WebTest Results after investigation in Visual Studio

So we can act directly by tracking all information needed on application level and simulate the load and usage of our application / System. Because of the good integration of Visual Studio, Visual Studio Online and Microsoft Azure Dashboard, we can request all Application Insights information for our applications to track like:• Application Health• Diagnostics• Performance• Usage Analytics ( X Days)• Operations • AccessIn the next series of this articles, I will take this topic a step further andwalk through other cool Application Insights futures and configurati-ons. So I will discuss the “Segmentation; Application Insights supportfor Multiple Environments, Stamps and App Versions; Search your logsinstantly using property filters”. Stay Tuned ;-).

Links: Getting started with Application Insights:http://azure.microsoft.com/en-us/documentation/articles/app-insights-get-started/Channel 9: Application Insights overview:https://channel9.msdn.com/Events/Visual-Studio/Connect-event-2014/216Application Insights SDK:http://blogs.msdn.com/b/visualstudioalm/archive/2014/10/21/application-insights-sdk-0-11-0-prerelease.aspxApplication Insights: Exception Telemetryhttp://blogs.msdn.com/b/visualstudioalm/archive/2014/12/12/application-insights-exception-telemetry.aspxMonitor any web site's availability and responsiveness:http://azure.microsoft.com/en-us/documentation/articles/app-insights-monitor-web-app-availability/Web tests for Microsoft Azure Websites:http://azure.microsoft.com/en-us/documentation/articles/insights-create-web-tests/ •

Page 15: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SQL Jeffrey Verheul

In the past, reading data from that one core production system wasn’tan issue. The invoice processes ran at night, and the process used tofinish before the first employee got in the office in the morning. Butwith the amounts of data currently being poured in the system, this becomes impossible. Redesigning the system takes up too much timeand money, so that’s off the table. So how do you technically solvethis puzzle, without rebuilding your entire architecture?

What is CDC?CDC (Change Data Capture) is a feature that’s included in SQL Server Enterprise. This gives you the opportunity to capture Inserts,Updates and Deletes of records on specific objects. This can be usedto perform “incremental updates” to the invoice system, instead ofreading the entire content of the database at night. So how does itwork?In SQL Server, every change you make to a record or table, is storedin the transaction log before your database is changed on disk. CDCreads the transaction log, and records all changes on the tables youhave enabled CDC on.

Enabling CDCEnabling CDC is as easy as running a query. First, let’s create some resources:

/* Create a database */

CREATE DATABASE CompanyInfo

GO

/* Use the database we just created */

USE CompanyInfo

GO

/* Create the Customer table */

CREATE TABLE dbo.Customer

(CustomerID INT IDENTITY(1,1),

FirstName VARCHAR(50),

LastName VARCHAR(50),

PhoneNumber VARCHAR(50),

AccountNumber VARCHAR(50),

CONSTRAINT PK_Customer PRIMARY KEY(CustomerID))

GO

Dealing with data is becoming a bigger challenge every day, if you work with a wrongly designed system. And haven’t we all been there? One of the senior software engineers designed the system, and tested it with 10.000 records. But in the past few years, he left, andthe system increased so much in size, that it’s impossible to work with it. And now a new invoice system (or a BI team for example) needs to read data from the same system. Throwing hardware at the problem isn’t an option, so what do you do next?

Decrease dataflows between systems with CDC

In order to use CDC, we need to enable CDC on the database, andon the table:

USE CompanyInfo

GO

/* Enable CDC on database */

EXEC sys.sp_cdc_enable_db

GO

/* Enable CDC on table */

EXEC sys.sp_cdc_enable_table

@source_schema = 'dbo',

@source_name = 'Customer',

@supports_net_changes = 1,

@role_name = NULL,

@index_name = 'PK_Customer',

@captured_column_list = 'CustomerID, FirstName, LastName,

AccountNumber'

GO

The query above only captures changed on the “FirstName”, “Last-Name” and “AccountNumber” columns (ID needs to be included, because it’s the primary key on the table). Changes on the “Phone-Number” column aren’t interesting for the invoice system. If you dowant to capture changed to that column, you can add it to the listpassed into “@captured_column_list” parameter. Another option is toleave out the “@captures_column_list” parameter, so it will capture allcolumns in the table.

After running these statements, SQL Server created a number of objects for CDC. The most important things: 2 functions you can queryto get data, 2 jobs (capture and cleanup), and a “Customer_CT” table(system table), where the data changes are stored.

Capture and CleanupAs long as the SQL Server Agent is running, changes are captured.The capture job, that is responsible for capturing all changes on CDC-enabled tables, runs every 5 seconds by default. This value canbe changed, but I’ve never seen a reason to change this.The cleanup job is responsible for removing old data from the “Customer_CT” table. By default, old data is removed after 4320 minutes (3 days). You can change this by executing this statement:

magazine voor software development 15

Page 16: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

Wednesday. The possibilities are endless, and can be fully customizedto work for your system.So how does this look in the 2 different functions?

As you can see, the all_changes function will return the inserted record(operation code 2), and the record after the update (operation code 4).The net_changes function, returns the combined result within thewindow you created. In this case, the inserted and updated recordare combined within a single record.Another option you have, is to retrieve data directly from the “Customer_CT” table. This option isn’t considered a best practice, butyou have the opportunity to do that if that suits you better.

Design decisionsIf you decide to use CDC, there are some design decisions you needto take a look at. One of the first things you need to think about is storage. Data changes are captured and stored, so you need someextra storage to save these records. Another thing to think about, isthe way your invoice system reads data from the primary system. Ifyou’re going to use CDC, you might need to change the way data isretrieved. But these changes might be easier, and much safer thanchanging your primary system. And if you use SQL Server IntegrationServices (SSIS) for example, there are some standard componentsyou could use. The changed you need to make depend on the system and architecture you have in your company.

ConclusionWith the options you’ve seen you can decide what works the best foryour system. There are alternatives you could use, but these optionsall require system changes, or are more intrusive on your system thanCDC. For example, you could use triggers on your tables, but thosetend to slow down your system.One thing is certain: CDC reduces theamount of data that needs to be exchanged between systems, andthe time needed to update secondary systems by a lot. And maybeeven more important to the business, it saves you from a huge investment needed to re-design the entire system!Personally, I would say CDC isn’t the silver bullet that solves all yourcross-system dataflow problems, but it is very effective when you useit the way it was intended: capture changes in a very lightweight way.The only real downside of CDC is that it’s an Enterprise-only feature.But the flexibility and compatibility (for example with SSIS and BIML)makes up for these shortcomings. CDC is definitely something to takea look at, even if you’re not a data professional! •

SQL

USE CompanyInfoGO

/* Change the retention for cleanup */EXEC sys.sp_cdc_change_job

@job_type = 'cleanup',@retention = 7200

GO

/* Check the result of the change */SELECTjob_type,retention

FROM msdb.dbo.cdc_jobs

In this case the retention of the data is changed to 7200 minutes. Thismeans that old data is deleted after 5 days. This setting gives you theopportunity to feed the invoice system with data for 5 days. This couldhelp you if there is downtime of your system, or if you have a mainte-nance windows for the system every week for example. If that’s notneeded, you could set it to a smaller value. How larger the value is,how longer you could query the change data, but also the more storage you need to store the change data.

Querying the dataNow that we’re storing the changed data, how do we query it? Thereare several options, all with their own pros and cons. Before we startquerying the data, let’s insert and update a record in the table:

USE CompanyInfoGO

/* Insert a customer record */INSERT INTO dbo.Customer

(FirstName, LastName, PhoneNumber, AccountNumber)VALUES('John', 'Doe', '555-6162', 'AA-5206204855882426')

GO

/* Update the LastName of the customer */UPDATE dbo.CustomerSET LastName = 'Smith'WHERE LastName = 'Doe'GO

The best practice to query the data, is to use the build-in functions.These functions (all_changes for the entire change set, or net_changesfor the combined changes), all work with LSN’s (Log Sequence Numbers). An LSN uniquely identifies a record in the SQL Server transaction log. These LSN’s can be translated to a readable “datetime” datatype. Also, a “datetime” datatype can be translated inan LSN. Translating can be done with the build-in functions:

/* Translate LSN to datetime */SELECT sys.fn_cdc_map_lsn_to_time(0x00000000000000000000)GO

/* Translate datetime to LSN */SELECT sys.fn_cdc_map_time_to_lsn('smallest greater than orequal', '1900-01-01')GO

With these functions, you can create your own “window” of data extraction. In practice this means that you can start your invoice process at 10PM, and in that window query data changed from yesterday 10PM, till today 10PM. Another option is to only querychanges for a specific day, for example between 10AM and 2PM on

MAGAZINE

16

Jeffrey Verheul

Jeffrey Verheul is a DBA and data-base developer from the Nether-lands, with over 10 years experiencein the Microsoft stack. After a shortside-track as a software engineer,he returned to his true love: SQLServer. His main focus is on data-

base development, performance tuning and database admini-stration. He is a member of the Friends of Red Gate, and blogsregularly on devjef.wordpress.com. You can contact him on hisblog, or via Twitter (@DevJef).

Page 17: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

CLOUD

Cloud Servies is een krachtig concept, maar er kleefde ook de nodigenadelen aan. Bestaande applicaties konden niet zomaar via de Lift enShift methode naar de Cloud gebracht worden. Meestal was dit gewoon te wijten aan de applicaties zelf. Weinig applicaties zijn ofwaren zuiver stateless, asynchroon in de basis en in staat als meerdereinstanties naast elkaar te draaien.

In de afgelopen jaren is het Azure platform rijker geworden met verschillende diensten. In plaats van iets zelf te verzinnen of te kopieren van anderen, zijn er nu bestaande tools/producten opgepakten in samenwerking geschikt gemaakt voor Azure (Hadoop, Docker,etc). Maar ook is IT development een stuk volwassener geworden.Developers en architecten realiseren zich steeds vaker dat Scale upniet helpt met availability, dat services/servers stuk gaan en dat een internet applicatie de potentie van een miljoenen publiek heeft.Standaard dogma’s als SOA architecture, Servicebussen of SOAPwebservices lijken ook hun kracht te verliezen, Microservices krijgenmeer draagvlak en betere tooling. Daarover ga ik zeker nog vaker bloggen.

Terug naar mijn Techdays demo. Die zag er zo uit:

De solution zag er zo uit. De code is te downloaden of op te vragen.

Zoals gezegd bestond het uit een WebRole en een WorkerRole. De WebRole voor het uploaden en bekijken van de plaatjes.

De flow van de applicatie zag er zo uit.

Zoals je ziet, de WebRole moest naast het uploaden ook een berichtop een queue zetten voor de WorkerRole. Aan de WorkerRole kantmoet er een mechanisme zijn om de queue leeg te lezen. Zoals ik vertelde in mijn sessie, moet je dan ook het Busy waiting oplossen. Het lezen van de queue is een transactie en dat kost geld. Een belangrijk onderdeel van architectuur op Azure is Cost Based design.Dus wil je het lezen van bijvoorbeeld een queue zo efficiënt en effectief mogelijk houden met het oog op de kosten.

Op Azure zijn tegenwoordig Webjobs beschikbaar. Met deze webjobsis het mogelijk om deze te laten triggeren na het toevoegen van eennieuwe blob op storage. Dat scheelt in mijn geval een bericht op dequeue en eigen check actie van de queue. Het hele wachten en kijkenof er werk (nieuwe blob op storage) is, wordt nu door het platform verzorgd en geregeld. En wat ik niet hoef te doen, dat scheelt tijd enhet platform kan dat efficiënter. Dus de WorkerRole wordt vervangendoor een Webjob. De WebRole heeft ook een alternatief. Moest ik voorde WebRole toch nog iets aparts leren, zoals bijvoorbeeld het lezenvan de configuratie settings. Met een Azure Website kan ik de technieken gebruiken die ik altijd al gebruikte. En voor de settings zieje in mijn vorige blogpost de oplossing.

Het proces plaatje ziet er dan zo uit.

Tijdens de afgelopen Microsoft Techdays 2014 deed ik een sessie over Azure Cloud Services.De opname is te vinden op Channel 9. In het begin van Azure waren Cloud services de “way to go”.

Marcel Meijer

Azure Webjobs

magazine voor software development 17

Page 18: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

CLOUD

En de website ziet er na een kleine redesign zo uit.

En de code van de Webjob is eigenlijk alleen dit, ongeveer 55 regels.

De WorkerRole besloeg ongeveer het dubbele aantal regels code,waarvan het grootste gedeelte zaken die niets met het proces temaken hebben.

Op deze manier krijg je precies zoals ik altijd zeg tijdens presentaties.We kunnen ons richten op de functionaliteit en het echte werk, de restwordt overgenomen en geregeld door het Azure platform.Nu moet de Client op een andere manier genotificeerd worden en nietop een queue hoeven te kijken.

NB In dit artikel beweer ik niet dat Cloud Services niet bruikbaar zijn.Voor het hier genoemde scenario waren de uitgebreide mogelijk hedenvan Cloud Services niet nodig. Er is op de Azure site (http:/ /azure.microsoft.com/nl-nl/documentation/articles/choose-web-site-cloud-service-vm/) een vergelijkend overzicht van de mogelijk -heden tussende verschillende oplossingen. •

Marcel Meijer

Marcel is een allround Microsoft Architect en Microsoft Cloud specialist bij Xpirit Nederland(www.xpirit.com), Marcel heeft almeerdere bedrijven geholpen metsuccesvolle Cloud/Microsoft Azureimplementaties. Hij is voorzitter vande Software Development Network(SDN), redacteur end event organi-

sator. Hij is ook een frequente blogger en spreker op verschillende community events en conferences in Nederland. Since 2010 maghij zich Microsoft MVP noemen.

MAGAZINE

18

TIP:Macro’s in Excel Werken niet meer na Office update

Als je Excel 2013 macro’s bevat en deze werken niet meer nade laatste Office update. De oplossing hiervoor is, zoek hetbestand MSForms.exd op. Deze staat normaal gesproken inde folder C:\Users\user.name\AppData\Local\Temp\Excel8.0\.

Verwijder het bestand MSForms.exd.

Bij het opnieuw opstarten van Excel 2013 wordt dit bestandopnieuw aangemaakt. Daarna werken alle VBA macro’s werken weer.

20maart

SDN Event Zeist

Page 19: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

So far for monoliths. Then in 1994 I joined a company that builddesktop applications - remember the world wide web was only a couple of years old, and web applications hadn’t been invented yet.We used a great tool called PowerBuilder and now we had two components to worry about; the application on the desktop and thedatabase on the server. The applications we build usually served departments or sometimes even a whole company. Not highly complicated, but not highly scalable either. Ah well, we had fun as longas the client-server paradigm lasted.

Component based developmentThe world got more complex in the mid-nineties. Companies wantedweb applications, basically running on intranets to get rid of desktopdeployments. And applications needed to serve multiple departments,and sometimes even break company borders. A new paradigm set in: component based development, also known as CBD. The paradigm promised us re-use, scalability, flexibility and a way to harvest existing code (usually written in COBOL). We started breakingup our systems into big functional chunks, and tried hard to have thosecomponents communicate to each other. Java was invented andeverybody now wanted to write code in Java (apparently some people still to this nowadays). Components where running in

Fig. 1: Scary stuff, an object request broker architecture

impossible technologies such as application servers and CORBA (toimpress your co-workers, look that one up on Wikipedia). The goodold days of object request brokers!

At that time I was working for a large international bank trying to setup an methodology for doing component based development. Evenwith a heavily armed team of Anderson consultants it took us threeyears to write the damn thing. In the end both the paradigm and thetechnology where too complex to write decent and well-performingsoftware. It just never took off.

Service oriented architectureAt that point in time, the early years of this century, I thought we gotrid of distributed software development, and happily started buildingweb applications. I guess everyone bravely ignored Martin Fowler’sfirst law of distributed objects: do not distribute your objects. Gradually we moved into the next paradigm of distributed computing,re-packaging the promises of component based development into arenewed set of technologies. We now started doing business processmodeling (BPM), and implemented these processes in enterprise services buses (ESB’s), with components delivering services.

Fig. 2: An enterprise service bus

Back in 1988, when I was first employed by a company for writing software, the world was fairlysimple. The development environment we had was character-based, the database was integrated and traversed with cursors, and we built a whole new administrative system covering everything but the kitchen sink. It took us five years to complete the project, basicallybecause the client kept changing his mind every now and then, and because every change in the code could break code elsewhere in the system. Unit testing hadn’t been invented yet,and testing was done by the end users. In production..

Microservices. The good, the bad and the ugly

Sander Hoogendoorn

magazine voor software development 19

Page 20: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

important role. IT need to support introducing a new product inmonths, if not in weeks. So we decided to be hip and go micro -services. Here’s my recap of the good, the bad and the ugly of microservice architectures, looking back on our first year on the road.

The goodLet’s start with the good parts. We build small components, each offering about two to six services. Good examples of such small components are a PDF component, that does nothing more than generate PDF’s from a template with some data, or a Customer component that allows users to search for existing customers. Thesecomponents offer the right size. The right size of code, he right size ofunderstandability, to right size to document, to test an to deploy.

The good

Our team tend to evolve towards small teams designing, implementingand supporting individual components. We didn’t enforce ownership,but over time small teams are picking up the work on a specific component and start feeling responsible for it.

When we outlined the basic architecture for our microservices lands-cape we set a number of guidelines. We are not only building smallcomponents, but are also building small single-purpose web applica-tions. Applications can talk to other applications, and can talk to components. Components handle their own persistence and storage,and can also talk to other components. Applications do not talk directly to storage. Components do not talk to each others storage.For us these guidelines work.

Microservices lives up to some of its promises. You can pick the righttechnology and persistence mechanisms for each of you components.Some components persist to relational databases (DB2 or SQLServer),others persist to document databases (MongoDB in our case). The hipster term here of course is polyglot persistence.We also stated that every application and component has it’s own domain model. We employ the principles and patterns of domaindriven design straightforward. We have domain objects, value objects,aggregates, repositories and factories. Because our components aresmall, the domain models are fairly uncomplicated, and thus maintainable.

Although we have had quite a journey towards testing our components and services, from Fitnesse to hand-written tests, we arenow moving towards testers specifying tests in SoapUI, which we arerunning both as separate tests and during builds. We had to learn tounderstand REST, but we’ve got this one figured out for now. Andtesters love it.

We were in the age of service oriented architecture, better known asSOA. Coming from CBD, SOA seemed easier. As long as your components- the producers - were hooked into the enterprise service bus, we figured out how to build-up scalable and flexible systems. We nowhad much smaller components that we could actually extract from ourexisting systems (now not only written in COBOL, but also in PowerBuilder, .NET and Java). The mandatory design patterns bookswhere published and the world was ready to go. This time we wouldcrack it!

I found myself working for an international transport company, and wehappily build around SAP middleware – delivering both ESB and BPMtooling. We now not only needed regular Java and .NET developers,but we employed middleware developers and SAP consultants aswell. And although agile was introduced to speed up development(I know, this is not the right argument), projects still suffered from sluggishness and moreover, when we got pieces of the puzzle in place,we started to realize that integration testing and deployment of new releases got more complicated by the day.

At last: microservices!I do hope you forgive me this long and winding introduction to the actual topic: microservices. You might think: why do we need yet another article on microservices? Isn’t there enough literature alreadyon the topic. Well yes there is. But if you look closely to the flood of articles that you find on the internet, most of them only describe thebenefits and possibilities of microservices (sing hallelujah), some ofthem take a look at the few famous path finding examples (Netflix,Amazon, and Netflix, and Amazon, and Netflix…). Only a few articlesactually dig a bit deeper, and they usually consist of summing up thetechnologies people seem to be using when implementing microservices. It’s still early in the game.

That’s were a little historical perspective won’t hurt. I find it interestingto witness that the benefits and possibilities of the predecessors ofmicroservices are still with us. Microservices seem to promise scalable and flexible systems, based on small components that caneasily be deployed independently, and thus promote use of the bestchoice in technologies per component. Basically the same promiseswe fell for with CBD and SOA in the past. Nothing new here, but thatdoesn’t mean that microservices aren’t worthwhile investigating.

Is it different this time around?So why is it different this time? What will make microservices the winning paradigm, where its predecessors clearly were not? Whatmakes it tick? As a developer, there’s no doubt that I am rather enthusiastic about microservices, but I was enthusiastic as well (moreor less) when people came up with CBD and SOA.I do suppose there are differences. For the first time we seem to havethe technology in place to build these type of architectures. All thefancy and complex middleware is gone, and we rely solely on verybasic and long-time existing web protocols and technologies. Justcompare REST to CORBA. Also we seem to understand deploymentmuch better, due to the fact that we’ve learned how to do continuousintegration, unit testing, and even continuous delivery. These differen-ces suggest that we can get it to work this time around.Still, from my historical viewpoint some skepticism is unavoidable. Tenyears ago, we also really believed that service oriented architecturewould be technologically possible, it would solve all our issues, and wewould be able to build stuff faster, reusable and more reliable. So, tobe honest, the fact that we believe that the technology is ready, is notmuch of an argument. Meanwhile the world also got more complex.Over the last year I’ve been involved with a company that is movingaway from their mainframe (too expensive) and a number of older Javamonoliths (too big, and hard to maintain). Also time-to-market plays an

MAGAZINE

20

Page 21: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

magazine voor software development 21

When we started our microservices journey, the team I’m was in ahighly reactive mode – tell us what to program and how to program it,and we’ll do our job. I probably won’t have explain what that doeswith the motivation of the team members. However, with micro servicesthere is no such thing as a ready-to-use cookbook or a predefined architecture. It simply doesn’t exist. That means that we continuousfind ourselves solving new pieces of the microservices puzzle, fromdiscovering how to design microservices (we use smart use case), tohow implement REST interfaces, how to work with a whole new setof frameworks, and a brand new way of deploying components. It’sthis puzzle that make working on this architecture interesting. We allowourselves to learn everyday.

The badBut as always, there’s a downside. When you start going down themicroservices road – for whatever you may find it beneficial - you needto realize that this is all brand new. Just think of it: if you’re not wor-king for Netflix or Amazon, who do you know who actually alreadydoes this already? Who has actively deployed services into production,with a full load? Who can you ask?

The bad

You need to be aware that you really need to dig in and get your handsdirty. You will have to do a lot of research yourself. There are no standards yet. You will realize that any choices you now make in techniques, protocols, frameworks, and tools is probably temporarily.When you are learning on a daily basis, newer and better options become available or necessary, and your choices will alter. So if you’relooking for a ready-made IKEA construction kit for implementing microservices the right way, you might want to stay away from microservices for the next five to seven years. Just wait for the bigvendors, they will jump in soon enough, as there’s money to make.

From a design perspective you will have to start to think differently. Designing small components is not as easy as it appears. What makesa good size component? Yes, it has a single business purpose, undoubtedly, but how do you define the boundaries of your component? When do you decide to split a working, operational component into two or more separate components? We’ve comeacross a number of these challenges over the past year. Although wehave split up existing components, there are no hard rules on when toactually do this. We decided mainly based on gut feeling, usually whenwe didn’t understand a components structure anymore, or when werealized it was implementing multiple business functions. It gets evenharder when you are chipping off components from large systems.There’s usually a lot of wiring to cut, and in the meantime you will needto guarantee that the system doesn’t break. Also, you will need a fairamount of domain knowledge to componentize your existing systems.

Basically we found that components are not as stable as we firstthought. Occasionally we merge components, but it appeared farmore common to break components into smaller ones to providereuse and shorter time-to-market. As an example, we pulled out aQ&A component from ourProduct component that now supplies questionnaires for other purposes than just about products. And morerecently we created a new component that only deals with validatingand storing filled-in questionnaires.

There’s lots of technical questions you will need to answer too. What’sthe architecture of a component? Is an application a component aswell? Or, a less visible one, if you are thinking of using REST as yourcommunication protocol – and you probably are – is: how does RESTactually work? What does it mean that a service interface is RESTful?What return codes do you use when? How do we implement errorhandling in consumers if something isn’t handled as intended by oneof our services? REST is not as easy as it appears. You will need to invest a lot of time and effort to find out your preferred way of dealingwith your service interfaces. We figured out that to make sure that services are more or less called in a uniform way, we’d better createa small framework that does the requests, and also that deals withresponses and errors. This way communication is handled similar withevery request, and if we need to change the underlying protocol orframework (JAX-RS in our case), we only need to change it in onelocation.

That automatically brings me to the next issue. Yes, microservices deliver on the promise that you can find the best technology for everycomponents. We recognize that in our projects. Some of our components are using Hibernate to persist, some are using a MongoDB connector, some rely on additional frameworks, such asDozer for mapping stuff, or use some PDF-generating framework. Butwith additional frameworks comes the need for additional knowledge.At this company, we will easily grow to over a hundred small components and maybe even more. If even only a quarter of theseuse some specific framework, we will end up with twenty-five to thirtydifferent frameworks( did I mention we do Java?). We will need toknow about all of these. And even worse, all of these frameworks (unless they’re dead) version too.

Then there’s the need to standardize some of the code you are writing.Freedom of technology is all good, but if every component is literallyimplemented differently, you will end up with an almost unmaintaina-ble code base, especially since it is likely that no-one oversees all thecode that is being written. I strongly suggest to make sure there’s coherence over your components on aspects of your code base thatyou could and probably should unify. Think of your UI components(grids, buttons, pop-ups, error boxes), validation (of domain models),talking to databases or how responses from services are formulated.Also, although I strongly oppose having a shared domain model(please don’t go that route), there’s elements in your domain modelsyou might need to share. We share a number of enumerations andvalue objects for instance, such as CustomerId orIBAN.

If you’re a bit like us this generic code ends up in a set of libraries - a framework if you will – that is reused by your components. We havelearned that with every new release of this home-grown frameworkwe end up refactoring some of the code of our components. I rewrotethe interface of our validation framework last week, which was necessary to get rid of some state it kept - components need to be stateless for clear reasons of scalability - and I’m a bit reluctant tomerge it back into the trunk when I get back to work after the weekend. Most of our components use it, and their code might notcompile. I guess what I’m saying here is that it’s good to have a home-grown framework. With some discipline it will help keep your

Page 22: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

MAGAZINE

22

code somewhat cleaner and a tad more uniform, but you will have to reason about committing to it and releasing new versions of it.

The uglySo what about the really nasty parts of microservices? Let’s start withdeployment pipelines. One of the promises of microservices is thatthey can and should be individually deployed and released. If you arecurrently used to having a single build and deployment pipeline for theone system you are building or extending, you might be in for a treat.With microservices you are creating individual pipelines for individualcomponents.

The ugly

Releasing the first version of a component is not that hard. We started with a simple Jenkins pipeline, but are currently investigatingTeamCity. We have four different environments. One for development,one for testing, one for acceptance and of course the production environment. Now we are slowly getting in the process of releasingour components, most of them with their own database, we start to realize that we can not do this without the support and collaborationof the operations team. Our expectations are that we will slowly evolveinto a continuous delivery mode, with operations incorporated in theteam. Right now we already have enough trouble getting operationson-board. They are now used to quarterly releases of the whole landscape, and certainly have no wish for individually deploying components.

Another that worries me is versioning. If it is already hard enough toversion a few collaborating applications, what about a hundred applications and components each relying on a bunch of other onesfor delivering the required services? Of course, your services are all independent, as the microservices paradigm promises. But it’s onlytogether that your services become the system. How do you avoid toturn your pretty microservices architecture into versioning hell - whichseems a direct descendant of DLL hell?

To be honest, at this point in time, I couldn’t advice you well on thistopic, but a fair warning is probably wise. We started out with a simple three digit numbering scheme (such as 1.2.5). The rightmostnumber changes when minor bugs have been solved. The number inthe middle raises when minor additional functionality has been addedto a component, and the leftmost number changes when we deploya new version of a component with breaking changes to its interface.Not that we strongly promote regularly changing interfaces, but it doeshappen.Next to that, we test our services during the build, both using codedtests and tests we assemble in SoapUI. And we document the requirements in smart use cases and domain models of our applications and components using UML. I’m quite sure in the futurewe need to take more precautions to keep our landscape sane, suchas adding Swagger to document our coded services, but it’s still toearly in the game to tell.

The hockey stick modelEarly in the game? Yes, we’ve only been on the road to microservicesfor about a year. And I still haven’t figured out whether we are on astairway to heaven or on a highway to hell. I do suppose, as with it’shistorical predecessors, we will end up somewhere in the middle, although I really do believe that we do have the technology to get thisparadigm working – and with we I don’t just mean Netflix, Amazon orsome hipster mobile company, but the regular mid-size companiesyou and I work for.

But will it be worthwhile? Shorten time-to-market? Deliver all the goodies the paradigm promises us? To be honest, I don’t know yet -despite or maybe even because of all the hype surrounding microser-vices. What I did notice is that, given the complexity of everythingsurrounding microservices, it takes quite a while before you get yourfirst services up and running, and we are only just passing this point.Some weeks ago, I was having a beer with Sam Newman, author ofBuilding Microservices. Sam confirmed my observations from his ownexamples and referred to this pattern as the hockey stick model.

There’s a lot to take care of before you are ready to release you firstservice. Think of infrastructure, sorting out how to do REST properly,setting up you deployment pipelines, and foremost change the wayyou think about developing software. But as soon as the first serviceis up and running, more and more follow faster and faster.

Be patientSo, if there’s one thing I’ve learned over the past year, it is to be patient – a word which definitively did not appear in my dictionary yet.Don’t try to enforce all kinds of (company) standards if they just don’texist yet. Figure it out on the fly. Allow yourself to learn. Take it step bystep. Simply try to do stuff a little bit better than the day before. Andas always, have fun! •

Sander Hoogendoorn

Sander is an independent consul-tant; as a mentor, trainer, coach,software architect, developer, writer,speaker, for his company ditisagile.nl (after the Dutch title ofmy latest book This Is Agile).Over the past decade, in my rolesas Principal Technology Officer andGlobal Agile Thoughtleader at

Capgemini. During this period I’ve learned a great deal and havecontributed to the innovation of software development at Capgemini and its many international clients.

Page 23: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

magazine voor software development 23

Tracing using the Elk stackMost distributed systems consist of different types of applications implemented using different programming language running on different operating systems. Normally these systems grow organicallyover time. There is not a single standard way of logging when a service or application fails.

Fig. 1: Microservices architecture

The most common way to log error events is writing these events inlog files. Each row of these text files minimally contain a timestampand some data about the event. With a distributed system such as amicroservices architecture this could mean that an engineer has to gothrough hundreds of log files to find a problem.

The ELK stack provides a solution for this problem by aggregating allof these log files into a single system. The ELK stack combines theElasticsearch, Logstash and Kibana products. Elasticsearch is asearch and analytics engine, Logstash is a tool for scrubbing and parsing log data into a single format and Kibana is a visualization engine to interact with Elasticsearch.

The logs of a system are transported through and enhanced by Logstash. The data is then indexed and stored by Elasticsearch andfinally visualized using the Kibana dashboard. All the components ofthe ELK stack are open source. Logstash is implemented using JRuby,

Elasticsearch uses Java and Kibana is implemented using HTML, CSSand JavaScript. Although these three products work great together,they can also be used separately.

Fig. 2: ELK stack overview

After the ELK stack is installed and configured you are able to searchin real-time through the logs of all your applications and services. UsingKibana you are able to visualize trends and spot anomalies in your logfiles.

Installing the ELK stackThe ELK stack can be installed on Unix as well as Windows. For thisarticle, I will be installing the ELK stack on a single Ubuntu server. The Ubuntu server will be running as a VM on the Microsoft Azure platform. The version of Ubuntu that I will be using is 14.04 LTS.

With all IT systems, traceability is an important non-functional requirement. If the traceability ofa system is high, it is easier to find the root cause of a problem that occurs in a production environment. As a system gets distributed over multiple applications or services, tracing a problem in a production environment becomes more difficult. As there are simply more appli-cation and services to check. New architectures such as a microservices architecture makes thiseven more difficult because the functionality of the system can literally be distributed over dozens or hundreds of services. The services could be implemented using different developmentlanguages and be running on different platforms. This article describes a solution for increasingthe traceability of a distributed system by using Log aggregation via the ELK stack.

Patrick Kalkman

Improving traceability of distributed systemsusing the ELK stack

There is not a single standard way of logging when a service or application fails

Page 24: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

MAGAZINE

24

The installation of all components is done through a remote shell, usingputty as an ssh client.

Installing ElasticsearchAs Elasticsearch runs on top of Java, the first prerequisite we have tofulfill before we can install Elasticsearch is Java. We install Java by entering the following command on the command line.

$ sudo apt-get install openjdk-7-jre-headless

This will download and install Java version 1.7. To validate if Java wasinstalled correctly we enter the following command.

$ java –version

If Java was installed correctly the following response will be generated(the version number may differ)

java version "1.7.0_65"

OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-

0ubuntu0.14.04.1)

OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

To install Elasticsearch we first have to download the package. We download Elasticsearch with the following command.

$ wget https://download.elasticsearch.org/elasticsearch/

elasticsearch/elasticsearch-1.4.1.deb

When downloaded we can install Elasticsearch with the following command.

$ sudo dpkg -i elasticsearch-1.4.1.deb

And start it with the following command

$ sudo service elasticsearch start

We can validate if Elasticsearch was installed and is running correctlyby entering the following command.

$ curl http://localhost:9200

Elasticsearch should give a JSON response that looks like the following

{

"status" : 200,

"name" : "Ultron",

"cluster_name" : "elasticsearch",

"version" : {

"number" : "1.4.1",

"build_hash" :

"89d3241d670db65f994242c8e8383b169779e2d4",

"build_timestamp" : "2014-11-26T15:49:29Z",

"build_snapshot" : false,

"lucene_version" : "4.10.2"

},

"tagline" : "You Know, for Search"

}

The name of the Elasticsearch node is automatically generated, so itwill probably be different in your installation.

We now have the E of the ELK stack running. Next, we will install Logstash.

Installing LogstashBefore we can install Logstash we first have to download the Log-stash package. We download Logstash with the following command.

$ wget https://download.elasticsearch.org/logstash/log-

stash/packages/debian/logstash_1.4.2-1-2c0f5a1_all.deb

And install it by entering the following command

$ sudo dpkg -i logstash_1.4.2-1-2c0f5a1_all.deb

There is an additional package with community added contributionsfor Logstash that we need. We download this package with the following command.

$ wget https://download.elasticsearch.org/logstash/log-

stash/packages/debian/logstash-contrib_1.4.2-1-

efd53ef_all.deb

And install it using this command.

$ sudo dpkg –i logstash-contrib_1.4.2-1-efd53ef_all

We then issue the following command to start Logstash

$ sudo service logstash start

This concludes the installation of the L part of the ELK stack. We moveto the last part, installing Kibana, the front-end.

Installing KibanaKibana is implemented using HTML, CSS and JavaScript. Therefore,to run Kibana we need a web server. Kibana runs completely client-side in the browser, so we don’t have any server side dependencies.If the web server can serve HMTL you will be ok. I will be using nginx.

To install nginx enter the following command

$ sudo apt-get install nginx

The installation process will automatically start nginx. To validate ifnginx is installed correctly and running issue the following command.

$ curl http://localhost

nginx should respond as follows

Kibana is implemented using HTML,CSS and JavaScript

Page 25: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

magazine voor software development 25

<!DOCTYPE html>

<html>

<head>

<title>Welcome to nginx!</title>

<style>

We download and extract Kibana by entering the following command

$ curl https://download.elasticsearch.org/kibana/kibana/ki-

bana-3.1.2.tar.gz

| tar xvz

We then have to copy the Kibana folder to the nginx html folder byentering the following command.

$ sudo cp kibana-3.1.2/* /usr/share/nginx/html –R

To validate if Kibana is working correctly we have to open two additional endpoints on the virtual machine running on MicrosoftAzure. One endpoint for port 80 to be able to talk to the web serverand another endpoint for port 9200 to let Kibana talk to Elasticsearch.

Fig. 3: Azure Endpoints

When you now browse to your webserver you should be welcomed bythe Kibana start screen.

Fig. 4: Kibana welcome screen

Congratulations, you have just installed all parts of the ELK stack.Next, we will look at configuring Logstash to get events into the system.

Fig. 5: Logstash configuration file structure

Configuring LogstashThe community maintaining Logstash has an interesting project principle. They say that if a newbie has a bad time using Logstash it’sprobably a bug. The documentation should have be better and moreinstructive.

Logstash is configured using a configuration file. A Logstash configuration file has the following structure.

The Logstash configuration file describes how events should flowthrough the Logstash pipeline with an input, filter and an output stage.

Input specifies the source of the data. This could be a file, a TCP portor other input plugins that are available. Filter defines how the input stream should be parsed.Output defines where the parsed output should be sent and stored.Each part of the pipeline can be configured using the logstash configuration file. The configuration file resembles the structure of thepipeline.

input {

}

filter {

}

output {

}

Logstash contains several plugins that can be configured in each partof the pipeline. The list is too extensive to list here, but these are someexamples.• Input plugins (log4j, collectd, eventlog, tcp, wmi, udp, heroku, file)• Filter plugins (grok, json, split, translate, drop)• Output plugins (elasticsearch, agios, http, stdout, rabbitmq, websocket, tcp)

See the Logstash website (http://logstash.net/) for a complete list ofavailable plugins.

The first real configuration we create is for parsing and indexing logsfrom an IIS server. We choose an IIS log because it contains a lot ofdifferent tokens we have to configure in the configuration file. Notethat this could be any log file.

The Logstash configuration file should be stored on our Ubuntu server in /etc/logstash/conf.d/logstash.conf

input {

lumberjack {

port => 6379

type => "IISLogs"

ssl_certificate => "/home/azureuser/logstash.crt"

ssl_key => "/home/azureuser/logstash.key"

}

}

filter {

if [type] == "IISLogs" {

if [message] =~ "^#" {

drop {}

}

grok {

If a newbie has a bad time, it's a bug

Page 26: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

MAGAZINE

26

match => ["message",

"%{TIMESTAMP_ISO8601:log_timestamp}

%{IPORHOST:site}

%{WORD:method}

%{URIPATH:page}

%{NOTSPACE:querystring}

%{NUMBER:port}

%{NOTSPACE:username}

%{IPORHOST:clienthost}

%{NOTSPACE:useragent}

%{NUMBER:response}

%{NUMBER:subresponse}

%{NUMBER:scstatus}

%{NUMBER:time_taken}"]

}

date {

match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]

timezone => "Etc/UCT"

}

useragent {

source => "useragent"

prefix => "browser"

}

mutate {

remove_field => [ "log_timestamp"]

}

}

}

output {

elasticsearch {

}

}

I will describe each part of the configuration file, starting with the input.

InputThe input plugin I am using is called lumberjack which is a specificinput plugin specially created for securely receiving events from Logstash-forwarder. Logstash-forwarder is a type of application runson your server and sends log events to the log server. Logstash-forwarder is an application that consume low resources.

The Logstash-forwarders motto:

The lumberjack input plugin has several configuration fields which define on what port and which certificate is used to setup an encrypted connection. We are using port 6379 for the lumberjackinput. To be able to send the log events securely to the server we needa certificate. This can be a self-signed certificate or a real certificate. I will show later how to create this certificate.The type fields adds a new field called ‘type’ to each event. The valueof this field when events are retrieved by lumberjack is “IISlogs”. Typesare mainly used for filter activation, we can specify that a certain filtershould only be used for events that have type=”IISLogs”, which wewill describe next.

FilterThe filter actually tries to parse the data of the event. The first line ofthe filter contains a condition which checks the type of the event.

if [type] == "IISLogs" {

This means that the lines following this condition will only be executedif the type of the event equals “IISLogs”. As you remember we addedthis type to events that are input using the lumberjack input plugin.

The next line states that events that start with a hash should be ignored.

if [message] =~ "^#" { drop {} }

Lines in an IIS log file that start with a hash indicate a comment. Theseare normally only present in the header of the IIS logfile.

The next part uses the Logstash GROK plugin. GROK is a wrapperaround a regular expression engine which enables you to reuse existing regex patterns. It is the ideal solution for parsing custom logmessages and comes with 120 existing patterns.

Using GROK we are going to parse a IIS log event. A log line of a IISlog event looks like the following:

2014-12-08 00:00:17 172.16.12.172 POST /url1/api.asmx - 443

VODKIJKWIN 192.168.16.135 PHP-SOAP/5.3.28-1~dotdeb.0 200 0 0

343

The grok match parameter specifies the pattern to parse this line.

grok {

match => ["message",

"%{TIMESTAMP_ISO8601:log_timestamp}

%{IPORHOST:site}

%{WORD:method}

%{URIPATH:page}

%{NOTSPACE:querystring}

%{NUMBER:port}

%{NOTSPACE:username}

%{IPORHOST:clienthost}

%{NOTSPACE:useragent}

%{NUMBER:response}

%{NUMBER:subresponse}

%{NUMBER:scstatus}

%{NUMBER:time_taken}"]

}

Note, that for readability the grok pattern has been split on to multiplelines. The actual grok match line should be on a single line.

It starts by reusing an existing pattern in grok called TIMESTAMP_ISO8601 which parses the date and time from the event and stores itinto the field log_timestamp and ends with NUMBER which is storedinto the time_taken field. An online tool is available http://grokdebug.herokuapp.com/ for testing grok patterns.

After the GROK stage of the filter we have parsed the IIS log line intoseveral specific fields.

I'm a lumberjack and I'm ok! I sleep when idle, then I ship logs all day! I parse your logs, I eat the JVM agent for lunch!

Page 27: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

magazine voor software development 27

The filter continues with using the date plugin. The date plugin is ableto convert a field into a date time and use that date time as the timestamp of this specific event.

date {

match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]

timezone => "Etc/UTC"

}

If no time zone is specified it adds a default time zone of “Etc/UTC” tothe event.

The user agent plugin parses user agentstring into structured data. It uses BrowserScope data to add information like family, operatingsystem, version and device. Browserscope is an open-source projectfor profiling web browsers and storing and aggregating crowd-sourceddata about browser performance.

useragent {

source => "useragent"

prefix => "browser"

}

The prefix field specifies to add “browser” to all of the extracted fields.

The last part of the filter shows the mutate plugin which enables youto mutate fields. You can remove, rename, replace or modify fields inevents.

mutate {

remove_field => [ "log_timestamp"]

}

Here we remove the log_timestamp field because we don’t need itanymore as it already converted into a timestamp.

As the log event is now parsed and has a timestamp it is time to moveit to the output.

OutputIn the output we specify a single output plugin. The elasticsearch plugin is obviously used for sending the event to Elasticsearch.

output {

elasticsearch {

}

}

Fig. 6: Shippers move events to Logstash

No other fields are specified as we are running Elasticsearch on thesame machine as Logstash. Otherwise we could have specified, forexample the host and port.

Restart LogstashWe have to restart Logstash after we have added or changed the Logstash configuration file. We restart Logstash with the followingcommand.

$ sudo service logstash restart

This concludes installing and configuring our ELK stack using a singleserver. The final part to getting log events into the server is adding andconfiguring a shipper on the server that contains the logs of the application that we want to monitor.

Sending events to LogstashWe first have to send the events to Logstash before we can parse,index and search through them. There are several so called shipperswhich are responsible for transmitting events to Logstash.

There are several shippers available that move events to Logstash.Logstash itself can also be used as a shipper. As Logstash runs witha footprint that is not friendly to under provisioned systems, severalalternatives were created that have a smaller footprint, for example, theearlier mentioned Logstash-forwarder. Other alternatives are Beaver(written in Python) and Woodchuck (written in Ruby).

I will be using Logstash-forwarder as I develop a lot of software thathas to run on Windows. Logstash-forwarder is developed in Go andas such can be compiled and run on Windows.

Currently there is no binary distribution of Logstash-forwarder, there-fore to use it you have to compile it first. Instructions can be found athttps://github.com/elasticsearch/logstash-forwarder.

As you may recall the input filter of Logstash used the lumberjack plugin to receive events from the logstash-forwarder.

input {

lumberjack {

port => 6379

type => "IISLogs"

ssl_certificate => "/home/azureuser/logstash.crt"

ssl_key => "/home/azureuser/logstash.key"

}

}

We are using port 6379 for the lumberjack input. To be able to sendthe log events securely to the server we need a certificate. This can bea self-signed certificate or a real certificate. I will be generating andusing a self-signed certificate.

I used the openssl command line to generate the self-signed certificateon the Ubuntu server. We generate a private key and certificate withthe following command.

$ openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout

logstash.key -out logstash.crt

The self-signed certificate needs several types of information to putinto the certificate. The only thing that is important is the CommonName, this must be set to the fully qualified domain name of the logstash server.

Page 28: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

MAGAZINE

28

After the self-signed certificate is created, you have to copy the logstash.key and the logstash.crt files from the Unbuntu server to thefolder on the machine that contains the logstash-forwarder.

Creating the logstash-forwarder configuration fileBefore we can start the logstash-forwarder we have to create a configuration file that instructs the forwarder where to get the log eventfrom and where to send them. Below a configuration file called logstash-forwarder.conf I use on a machine to send IIS logs to my central logstash server.

{

"network": {

"servers": [ "elkstack.cloudapp.net:6379" ],

"ssl ca": "Logstash.crt"

},

"files": [

{

"paths": [ " C:\\inetpub\\logs\\LogFiles\\W3SVC1\\*.log"

],

"type": ["IISLogs"]

}

]

}

It specifies under network which certificate to use and to what serverthe logs should be sent The files parameter specifies which paths andpattern should be used to search the log files. Pay special interest tousing the double backslash on Windows as a folder separator. Beforestarting the logstash forwarder I have to add another end point to myAzure virtual machine to let Logstash connect to port 6379.

Fig. 7: Specific end point for Lumberjack

Fig. 8: Default Logstash dashboard in Kibana

The Logstash forwarder can now be started with the following command.

C:\lgf> logstash-forwarder.exe -config=logstash-forwarder.conf

The logstash-forwarder will monitor the folder for new or added logfiles and will send them to the logstash server. To run logstash-forwarder in the background as a Windows service, we have to con-vert it into a Windows service. This can be done using NSSM (theNon-Sucking Service Manager) from http://nssm.cc/

Filtering events using KibanaAfter we got the event flowing into the server, we can visualize theevents using Kibana. With Kibana you can create and save customdashboards. The default installation already contains a dashboardwhich is configured for Logstash as can be seen in Figure 8.

The default Logstash dashboard contains a graph which counts thenumber of events over time and includes a search field which allowsyou to search on free text or search in specific fields. The functionality of Kibana deserves a separate article on its own.There are multiple ways to create graphs, combine geo-ip data and filters.

Fig. 9: Kibana extended dashboard

Scaling the ELK stackAs we are going to expand our system to receive and group morelogs, the single Logstash server that we are currently using won’t be sufficient. We have to scale our architecture. Current it looks like Figure 8.

Fig. 10: Current Architecture

The first thing we can scale is the Broker. Broker is the part that receives the log events. Currently we are using the message bufferfrom Logstash. A good way to scale the broker is to use Redis on aseparate server to acts as a broker. Redis is a popular open source keyvalue storage. Logstash includes plugins for using Redis.

To increase the throughput of the Indexer, we could also separate Logstash from Elasticsearch. So the new architecture looks like

Redis is a popular open source keyvalue storage

Page 29: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

GENERAL

magazine voor software development 29

Fig. 11: Scaled Architecture

Fig. 12: Horizontally Scaled Architecture

This architecture can be scale horizontally very easily. We can addmore Redis servers to increase the queue capacity, we can add moreLogstash server to increase indexing capacity and add more nodes tothe Elasticsearch cluster to increase the performance of querying andfiltering of data. A first step into scaling horizontally looks like Figure 10.

By cross connecting both Redis servers and the Logstash indexer wealso create redundancy and fault tolerance between the systems. Theshippers also can connect to both Redis servers so that if one of theservers goes down, a shipper is still able to send its events.

Elasticsearch can be scaled by adding new Elasticsearch nodes tothe Elasticsearch cluster. It will automatically detect and distribute dataover the available nodes.

Configuring the Scaled ArchitectureTo configure the horizontally scaled ELK stack we need to make somechanges to the configuration files.

The Logstash configuration file on both indexers needs to change. We use the Redis plugin to get the input from both Redis servers.

input {

redis {

host => "redis-server1"

port => 6379

data_type => "list"

key => "logstash"

}

redis {

host => "redis-server2"

port => 6380

data_type => "list"

key => "logstash"

}

}

Currently Logstash-forwarder does not support connecting to Redis.

The protocol that Logstash-forwarder uses includes compression, encryption and message acknowledgement, which Redis does notsupport. There are alternative shippers which do, such as beaver andwoodchuck.

If we switch to using Logstash as a shipper we could configure it usingthe following output filter in which the events are sent to one of thetwo configured Redis servers.

output {

redis {

host => ["redis-server1:6379", "redis-server2:6380"]

}

}

ConclusionIn this article I showed how to install and configure the ELK stack insuch a way that enables transfering application logs from a Windowsmachine using logstash-forwarder to the machine that hosts the ELKstack. The host parses the application logs using Logstash, indexesthe logs using Elasticsearch and allows visualizing hem using Kibana.

By combining the logs from all your services and applications you canimprove the traceability of your IT system. All your logs becomesearchable in almost real-time. By parsing extra information using Logstash per application you could give more meaning to your existing logs without having to go through all the logs individually.

To scale out the ELK stack, Redis servers can be added together withseparate Logstash servers. Scaling Elasticsearch is as easy as addingnodes to the cluster. The easy way the ELK stack can be scaled horizontally really shows the strength of the platform.

This article barely scratched the surface of what you can do with theELK stack. Topics I did not cover but are very interesting are security,creating dashboards with Kibana, adding semantics to log events,alerting, exporting and creating your own Logstash plugins.

Other alternative platforms for log aggregation that you should consider when evaluating a log aggregation platform are Splunk, Sumologic and Scribe. •

Patrick Kalkman

Patrick Kalkman is a software architect at HintTech where he designs and implements state of theart web applications using an agileproces.

Elasticsearch can be scaled by adding new Elasticsearch nodes to the cluster

Page 30: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SQL Peter ter Braake

HekatonHekaton was de code naam voor de In-Memory engine van SQL Server. Hekaton komt uit het Grieks en verwijst naar de ambitie van Microsoft om SQL Server honderd keer zo snel te maken. Honderdkeer! Honderd keer is bij lange na niet gehaald, maar de resultaten zijnondanks dat meer dan indrukwekkend.Hekaton, ofwel memory optimized tabellen, is één van de vele nieuwein-memory features. De database engine van SQL Server is in de kernalle ruim twintig jaar oud. Veel designkeuzes zijn dus ook al meer dantwintig jaar geleden gemaakt. Weet u nog met welke computer u twintig jaar geleden werkte?De hardware van toen was ontzettend beperkt ten opzichte van dehuidige hardware. Voornamelijk de hoeveelheid geheugen die we tegenwoordig met 64-bits computers kunnen is drastisch toegeno-men. Tegelijkertijd is de prijs gekelderd zodat ook iedereen zich datgeheugen kan permitteren. Door de dure en beperkte hoeveelheid geheugen van toen is SQL Server een file-based database. Hoewel deengine zoveel mogelijk gebruik maakt van geheugen middels de buffer pool, is het uitgangspunt dat de gegevens op disk staan. De datafiles op disk waar de gegevens in opgeslagen worden, zijn opgedeeld in blokken van 8 KB, de pages. Ook in het geheugen zitten de records nog steeds opgeslagen op die pages.

LatchesHoewel het concept van pages een optimalisatie betekende voor file-based databases, levert het ook beperkingen op. Op het moment datSQL Server een nieuw record moet wegschrijven, of dat een bestaandrecord gewijzigd moet worden, bestaat er de kans dat records over elkaars ruimte heen schrijven. Dat zou inconsistenties (corruptie) veroorzaken. Daartegen moet SQL Server ons beschermen.

Fig. 1

De bescherming die SQL Server biedt wordt een latch genoemd. Latches worden vaak uitgelegd als zijnde light-weight locks. Maar nuweet u nog niet veel meer. Als een proces begint met schrijven, wordtde hele pagina geblokkeerd voor dat proces. Totdat het proces klaaris met schrijven, kunnen andere processen niet met die pagina

werken. Als er maar één proces actief is in uw database, is dat geenprobleem. Maar hoe meer cores u heeft, hoe meer processen tegelij-kertijd actief zijn. Dat houdt in dat de kans dat een proces moet wachten op een ander proces steeds groter wordt. Wachtende processen is wat mensen ervaren als slechte performance.In het screenshot van figuur 1 ziet u het aantal transacties per secondein een voorbeeld applicatie van Microsoft. In dit voorbeeld zijn dat 520transacties per seconde. Opvallend is het CPU verbruik van nog geen50%. Meer CPU’s gaat waarschijnlijk niet helpen om meer transactieste verwerken. Tweede opvallende feit is het aantal latches per seconde. Die latches kosten overhead in het systeem en veroorzakenwachttijden bij andere user processen. Daar zit de grote bottleneck.

Memory optimized tablesMet Memory optimized tables draait Microsoft het uitgangspunt vanSQL Server om. Gegevens zitten in principe in het geheugen. Uiteraardmoet alle data uiteindelijk ‘landen’ op disk, anders bent u die datakwijt. Memory optimized tables zijn wat in theorie genoemd wordt:fully durable. Dat wil zeggen dat als een transactie succesvol is afgerond, de gegevens gegarandeerd in de database zitten en nietmeer kwijt kunnen raken. Gegevens worden dus weggeschreven naardisk, maar het uitgangspunt is dat de gegevens in het geheugen zitten. Daarvoor wordt geoptimaliseerd.

Omdat gegevens worden opgeslagen in geheugen is het concept vanpages niet langer nodig. Een record zit in geheugen op een willekeurige plek die toevallig vrij was toen het geschreven werd.Omdat een record niet op een pagina staat, hoeft er ook geen latchte zijn om per ongeluk overschrijven van gegevens te voorkomen. Zonder latches zijn er ook geen processen die moeten wachten oplatches. En minder wachtende processen is betere benutting van debeschikbare CPU’s, is betere performance.

LocksPagina’s worden beschermd met latches, records worden beschermddoor middel van locks. Naast het feit dat twee processen op dezelfdepagina moeten zijn, kan het ook voorkomen dat ze met hetzelfde record werken. Locks voorkomen problemen door één van de processen te laten wachten. Memory optimized tabellen hanteren eenlock and latch free mechanisme. Of in een moeilijk woord: optimisticmulti version concurrency control. Een record wordt eigenlijk nooitmeer gewijzigd. Een record wordt simpelweg met een timestamp

MAGAZINE

30

SQL Server In-Memory OLTP2014 was het jaar van de release van SQL Server 2014. Nog meer dan dat was het het jaar vande release van tientallen nieuwe cloud services. Dit artikel gaat (een keer) niet over de cloud ofover Azure. Dit artikel gaat over een nieuwe revolutionaire engine die volledig is geïntegreerd inSQL Server: Hekaton!

Memory optimized tables omgekeerduitgangspunt van SQL Server; Memory first then disk

Page 31: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SQL

magazine voor software development 31

gemarkeerd als oud en er wordt een nieuw record aangemaakt. Tweeprocessen die tegelijkertijd met een record werken krijgen allebei huneigen versie van het record.

Natively compiled stored proceduresZonder locks en latches wordt een grote performance bottleneck weggenomen. Maar valt er nog meer te winnen? Zonder locks andlatches wordt de CPU voor 100% gebruikt in de voorbeeldapplicatievan figuur 1. SQL Server zou eigenlijk in staat moeten zijn om met dezelfde hoeveelheid CPU cycles, meer werk te doen. Dat is precieswat u bereikt met natively compiled stored procedures. Tijdens deCREATE van deze stored procedures worden deze gecompileerd toteen C-dll. Deze vooraf gecompileerde code is veel beter geoptimali-seerd dan interpreted T-SQL en daardoor veel sneller.Natively compiled stored procedures kunnen nog niet de volledigeSQL functionaliteit gebruiken. Niet alle data types worden onder-steund, niet alle functies worden ondersteund. Bovendien kunt u meteen natively compiled stored procedure alleen werken met memoryoptimized tables, niet met klassieke file based tables. Andersom kanwel. Met Query interop wordt bedoeld dat u met gewoon SQL zowelgewone tabellen als memory optimized tables kunt benaderen.Alles bij elkaar krijgt u een architectuur zoals in figuur 2.

Fig. 2

Impact voor de programmeurDit klinkt allemaal fantastisch, maar waarom dat verhaal in het Developers Magazine? Helaas is memory optimized tables geen feature die je aan of uit zet en die zonder verdere aanpassingen voordeel oplevert. De programmeur zal in zijn of haar code rekeningmoeten houden met de feature. Allereerst zijn er enkele zaken om overna te denken bij het maken van de tabel.

Een memory optimized tabel kent geen ALTER TABLE. Van een tabelwordt, net als een natively compiled stored procedure, tijdens de CREATE een dll gemaakt. De enige manier om die aan te passen ishem weggooien om hem daarna opnieuw aan te maken. Dit klinktmisschien nog wel overkomelijk, maar geldt ook voor indexen. Ookindexen kunnen niet later aangemaakt worden of verandert worden.Memory optimized tabellen kennen twee soorten indexen, hash indexes en range indexes. Beide worden tijdens de CREATE TABLE algedefinieerd. Bij de hash index moet u opgeven uit hoeveel hash buckets de index bestaat. De vuistregel is dat u ongeveer twee keerzoveel hashbuckets maakt als dat u unieke waarden in de te indexerenkolom heeft. Maar u moet wel vooraf een keuze maken.

Dat is niet meteen vanzelfsprekend.De CREATE TABLE ziet er als volgt uit.

CREATE TABLE Sales.SalesOrderDetailHashOnly

(

[SalesOrderID] [int] NOT NULL,

[SalesOrderDetailID] [int] NOT NULL PRIMARY KEY NON-

CLUSTERED HASH WITH (BUCKET_COUNT=200000),

[CarrierTrackingNumber] [nvarchar](25) NULL,

[OrderQty] [smallint] NOT NULL,

[ProductID] [int] NOT NULL INDEX IXH_ProductID NON-

CLUSTERED HASH WITH (BUCKET_COUNT=300),

[SpecialOfferID] [int] NOT NULL,

[UnitPrice] [money] NOT NULL,

[UnitPriceDiscount] [money] NOT NULL CONSTRAINT

[DF_SalesOrderDetail_UnitPriceDiscount] DEFAULT ((0.0)),

[LineTotal] [money],

[rowguid] [uniqueidentifier] NOT NULL CONSTRAINT

[DF_SalesOrderDetail_rowguid] DEFAULT (newid()),

[ModifiedDate] [datetime] NOT NULL CONSTRAINT

[DF_SalesOrderDetail_ModifiedDate] DEFAULT (getdate())

) WITH (MEMORY_OPTIMIZED = ON, DURABILITY =

SCHEMA_AND_DATA);

Het goede nieuws is dat dit hoofdzakelijk is wat u gewent bent. Letvooral op de inline indexen en de bucket count bij de hash indexen.Verder valt op dat het statement eindigt met MEMORY_OPTIMIZED = ON

en DURABILITY = SCHEMA_AND_DATA. Voor durability zijn er tweeopties: schema_and_data en schema_only. Met die laatste zitten degegevens alleen in memory, nooit op disk. Bij een server herstart bentu dus alle gegevens kwijt. Voor situaties als state van een website ofstaging tabellen bij ETL kan dat grote voordelen hebben.Bij het maken van een natively compiled stored procedure komt netiets meer nieuwe kennis kijken. De code begint altijd als volgt:

CREATE PROCEDURE usp_InsertOrderMemoryOptimized

@SalesOrderID int, @SalesOrderDetailID int, @OrderQty smal-

lint, @ProductID int

WITH NATIVE_COMPILATION

, SCHEMABINDING

, EXECUTE AS OWNER

AS

BEGIN ATOMIC WITH (

TRANSACTION ISOLATION LEVEL = SNAPSHOT

, LANGUAGE = 'us_english'

, DELAYED_DURABILITY = OFF)

Het eerste dat opvalt, is de optie WITH NATIVE_COMPILATION. Dieoptie heeft geen verdere uitleg nodig. Omdat er een dll gemaakt wordtis de optie SCHEMABINDING verplicht. Verder is het verplicht eenexecution context te bepalen, de owner in dit voorbeeld.Vervolgens begint u altijd met de clausule BEGIN ATOMIC BLOCK.Zoals gezegd gaat memory optimized uit van optimistic multi versionconcurrency control. Dat houdt in dat er niet vooraf door middel vanlocks beschermd wordt tegen concurrency problemen. Iedereen werktmet zijn eigen versie van de records. Op het moment dat u uw trans-actie commit, wordt pas gekeken of uw versie wel commitbaar is. Hetkan zijn dat iemand anders u voor is geweest en al een wijziging heeftdoorgevoerd. U krijgt dan een foutmelding. Error handling code is dusvan essentieel belang binnen uw stored procedure. Gelukkig kent T-SQL TRY … CATCH en sinds SQL Server 2012 ook THROW. Uw stored procedure is altijd een atomic block, ofwel een transactie.

Memory optimized tables een Developers taak

lees verder op pagina 35 >

Page 32: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SCRUM Piet Willem Overvoorde

De uitdaging (opdracht) is om de effecten van het werken op basisvan SCRUM te delen met de organisatie met het doel als collectiefnog effectiever en efficiënter samen te werken.

Belangrijke kernmerken van SCRUM zijn:• Eenduidig interpreteerbare werk- en projectafspraken;• Op basis van geplande evaluatie momenten continue aandachtvoor opzet en inhoud van de werkzaamheden; maar aan gemaakte afspraken wordt niet getoornd;

• Korte, afgeronde werkzaamheden;• Geen ad-hoc interventies;• Team prestatie is bepalend (zelfsturende en zelflerende organisatie);

• Continue aandacht voor de kwaliteit van het door alle betrokkenpartijen geleverde product;

• Rust en duidelijkheid in het project en in het proces.

SCRUM is veel breder toepasbaarOveral waar er sprake is van een opdrachtgever en van het halen vanfinanciële, inhoudelijke- en planningsdoelstellingen is SCRUM toepasbaar. Inderdaad niet altijd in de meest zuivere vorm maar wel alshandvat voor het maken van afspraken en het opvolgen en managenhiervan. Als het eindproduct vast staat, heeft SCRUM geen toege-voegde waarde. Als voorbeeld de auto: het ontwikkelen kan metscrum, het produceren van de auto bijvoorbeeld met lean. Wanneer je de hiervoor beschreven kenmerken van SCRUM nog eenkeer doorneemt en projecteert op de dagelijkse werkelijkheid van

bijvoorbeeld de samenwerking tussen sales en delivery in verkoop enimplementatie trajecten dan blijkt dat deze aanpak zonder meer ookhierop prima toepasbaar is.

Waarom het SCRUM gedachtengoed als basis voor het beheervan processen?De voordelen van het gebruik van (een variant) van SCRUM in salesprocessen zijn onder andere:• Duidelijke afspraken tussen alle deelnemers (sales, pre-sales, delivery/operations, prospect, adviseur etc.);

• Heldere lijnen voor het managen van het proces;• Alle deelnemers worden ‘gedwongen’ vooraf heel goed nagedachtte hebben;

• Voor en bij het afsluiten van het contract zijn alle relevante partijenbetrokken geweest.

Naast een eenvoudiger en succesvoller beheer van de genoemdevoorbeeld processen leidt een breder gebruik van (de uitgangspun-ten van) SCRUM ook tot een verbeterd begrip, over en weer, tussende verschillende bloedgroepen binnen een organisatie. De zakenwaarmee sales, project management, consultancy en ontwikkeling dagelijks te maken hebben in hun ‘eigen wereld’ worden binnen hetteam gedeeld. Het team is verantwoordelijk voor het realiseren van dedoelstellingen en niemand kan zich achter de performance van eenander verschuilen.

Een andere, meer effectieve en resultaatgerichte vorm van samenwerkingDe eerder in dit stuk genoemde rust en duidelijkheid komen, wanneerdeze manier van werken effectief is geïmplementeerd, iedereen tengoede. Ad hoc vragen en interventies van collega’s en zeker ook vanmanagers mogen in principe niet meer voorkomen.

MAGAZINE

32

SCRUM is veel meer daneen project managementmethodologieDat is zonder meer waar en een methodologie die, mits die op de goede manier wordt gebruikt,heel goed toepasbaar is op allerlei soorten projecten. Dus het gebruik ervan is zeker niet beperkttot ICT (gerelateerde) ontwikkelingen. Scrum is prima toepasbaar bij complexe producten (eindproduct is moeilijk vooraf tot in detail te beschrijven) en bij complexe organisaties (veel stakeholders).

SCRUM leidt tot verbeterd begrip tussen de verschillende bloedgroepenbinnen een organisatie

Page 33: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SCRUM

magazine voor software development 33

Ieder lid van het team moet acteren als eigenaar en verantwoordelijkevoor het eindresultaat (overall en van een sprint). En in die rol wil jezaken niet over hoeven doen omdat de WAT vraag niet voldoende isuitgevraagd. Of het antwoord op de HOE vraag niet op de beste manier is afgestemd en geformuleerd. SCRUM kan in een bepaalde vorm worden toegepast voor de beheersing van andere processen. Maar de volgende zaken kunnenzonder meer organisatie breed worden geadopteerd:• Het benoemen van de doelstelling(en)/het product van de samen-werking, de WAT vraag;

• Het definiëren van sprints/stappen waarbinnen het antwoord op deHOE vraag vorm moet krijgen (of deze allemaal van een gelijke duurmoeten en kunnen zijn is sterk afhankelijk van het project en dehierin onderkende stappen; het verzorgen van een demo kost bij-voorbeeld minder tijd dan het beantwoorden van een RFI of RFP);

• Het toekennen van duidelijke taken en verantwoordelijkheden aande Product Owner, de SCRUM Master (of de procesbeheerder) enhet team (of de teams, wanneer die per sprint verschillend zoudenzijn; dit laatste is een concreet verschil tussen SCRUM in de zuivere vorm als project management tool (vooral gebruikt binnen deontwikkeling van softwarematige toepassingen) en de SCRUM methodologie als kapstok voor het managen van andere soortenprojecten/activiteiten);

• Gebruik maken van de praktische hulpmiddelen zoals de rol van deSCRUM Master, de dagelijkse afstemming/update, het SCRUMbord (met alles dat daar deel vanuit maakt) en de pokerkaarten;

• En na afloop een integrale evaluatie van de kennis en ervaring dievanuit het project kan worden meegenomen en ingezet om toekomstige projecten nog beter te laten verlopen.

Een andere vorm van samenwerking is noodzakelijkWe zitten in de eindigende periode dat alles binnen dezelfde zogenaamde ERP oplossing moet kunnen worden opgelost. Op basisvan de standaard set aan functionaliteiten gecombineerd met branchespecifieke modules en maatwerk. Initieel is dit zonder meer een goedegedachte.

De ervaring heeft geleerd dat er in de loop van de tijd vaak sprake isvan a-synchronisatie tussen de ondersteunde versies van applicaties,besturingssystemen, ontwikkelomgevingen en databases. Dit heeft temaken met de periodieke heroverweging met betrekking tot bran-chefocus en de wil en mogelijkheid om in een ontwikkeling te blijveninvesteren. De wil wordt o.a. bepaald door de kans op een redelijkrendement.

Er zal gebruik gemaakt gaan worden van ‘best of breed’ oplossingenals basis voor de ondersteuning van alle voor een organisatie relevante

bedrijfsprocessen. Combinaties van allerhande, technische en functioneel, rol/ functie gerichte, tools. Dat is nu ook mogelijk omdathet koppelen van oplossingen en het synchroniseren van databasesveel eenvoudiger is geworden. Door de focus van alle betrokken partijen is de kans groot dat een investering een veel meer toekomst-bestendige blijkt te zijn. De behoefte aan het eenvoudig kunnen delenvan informatie zal ook verder toe gaan nemen.

De ontwikkeling die hiervoor is beschreven met betrekking tot ICT oplossingen geldt ook voor heel veel andere soorten projecten. Steedsmeer is er sprake van virtuele, project specifieke, teams van professi-onals die het afgesproken resultaat tot stand moeten brengen. Het gebruik van een erkende en gestandaardiseerde project aanpakbiedt dan uitkomst. En voorkomt allerhande spraakverwarring met betrekking tot verwachtingen, communicatie, voortgangsrapportageetc. Het is om die reden dat het aantal online SCRUM ondersteunendetools zeker toe zal nemen in de komende periode.

Gaat die samenwerking vanzelf en gelijk goed?Het is voor medewerkers en managers wennen wanneer SCRUMbreed in de onderneming wordt geïntroduceerd. De hiervoor zo benoemde verschillende bloedgroepen binnen een organisatie, sales,consultants, ontwikkelaars, project leiders en managers, zullen stukvoor stuk het gevoel kunnen hebben dat anderen in hun domein ‘binnen dringen’.

Dat is natuurlijk ook zo, maar erg is anders! De samenwerking moetworden gebaseerd op een oprecht onderling vertrouwen: gemaakteafspraken moeten gestand worden gedaan. En als daar reden voor isdan worden zorgen en aandachtspunten tijdig onderkend en gedeeld.Een heel groot voordeel voor de betrokken managers is dat zij hun eigenlijke rol en opdracht inhoud kunnen geven. Het succes moet zijn gebaseerd op het op deze manier WILLEN werken. En iedereen beperkt zich in dit geval niet tot de interne organisatie. Binnen de teams zullen ook partners, prospects en klan-ten actief zijn. Het is goed om de introductie van deze werkwijze op tepakken samen met een of meerdere bestaande klanten en partners.

Is dit de basis voor het succes van ieder project?Nee! Hoe goed een project aanpak ook is, het team bepaalt het succes. Ook in sectoren waar er sprake is van strikte regels en procedures, zoals in de luchtvaart, de gezondheidszorg en de offshore, gaan er dingen mis. Maar oorzaken worden snel achterhaald.En de nodige maatregelen snel genomen. Wanneer het aantal variabelen toeneemt, neemt de behoefte aan duidelijke afspraken en kortlopende trajecten toe. Korte, overzichtelijketrajecten waardoor de risico’s tot een minimum worden beperkt worden steeds meer geëist door de klant. En dat is de basis vanSCRUM. Dingen opnieuw doen is vaak mogelijk. Maar werkzaam -heden over-/anders doen is altijd kosten¬verhogend, marge verlagenden reputatie schadend.

De implementatieVoor iedere verandering die wordt doorgevoerd geldt dat deze gaandehet proces en mede op basis van de input van alle betrokkenen vormmoet krijgen.

Een heel groot voordeel van de introductie van SCRUM als uitgangs-punt voor de vormgeving van de samenwerking is dat vanaf het prillebegin op deze manier gewerkt kan, beter zal worden.

De samenwerking is gebaseerd op onderling vertrouwen

Page 34: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SCRUM

MAGAZINE

34

Daardoor worden stap voor stap meer mensen hiermee bekend engroeit het vertrouwen dat dit inderdaad een positieve bijdrage zal gaanleveren. Naast het organiseren van allerhande praktische zaken moetin dit proces de ‘menselijke’ kant zeker niet worden onderschat en vergeten. Diverse rollen binnen de organisatie zullen een ander karakter krijgen. Dit vraagt aanpassing van het dagelijkse doen enlaten.

Zoals eerder gememoreerd is het ontwikkelen van een authentiek onderling vertrouwen een heel belangrijk aspect. Naast een goede uitwerking van de praktische aspecten en tools is een goede, professionele begeleiding op het ‘menselijke’ vlak zonder meer noodzakelijk.

De beoordeling van de medewerkers moet primair gericht zijn op derealisatie van (collectieve) lange(re) termijn doelstellingen. Wanneer persoonlijke belangen (beloning, prestige, kans op promotie etc.) deboventoon voeren in het besluit onderdeel te willen zijn van bepaaldeprojecten dan zal deze methodiek nagenoeg zeker haar doel niet bereiken.

Het management moet er klaar voor zijn of klaar voor gestoomd willen worden. Zo nodig ondersteund door een vorm van professioneleinhoudelijke en persoonlijke coaching. Het commitment van alle managers is een essentiële bouwsteen van een succesvolle implementatie.

ConclusieDe introductie van een op de uitgangspunten van SCRUM gebaseerdesamenwerking tussen alle bij een organisatie betrokken partijen biedteigenlijk alleen maar voordelen. Mits dit proces vanaf het begin op eengoede en professionele manier is gemanaged.• Duidelijkheid in doelstellingen, werkwijze, taken en verantwoorde-lijkheden;

• Substantiële verbetering van de juistheid van het antwoord op devraag WAT er wordt verwacht;

• Een duidelijke kwaliteitsverbetering van het antwoord op de HOEvraag;

• Efficiency verbetering op vele fronten, bezig zijn met de juiste dingen;

• Verbetering en verduurzaming van de relatie en samenwerking metklanten en partners;

• Versterking en verdieping van het onderlinge begrip en vertrouwenen daarmee de teamgeest.

Kortom: zeker het overwegen waard!

Is dit alles nieuw en innoverend? Nee, bijna altijd is er voor elk proces een project-en procesaanpak aanwezig. Gedreven vanuit deprimaire behoeften van de ‘bloedgroep’. Ja, want heel weinig organisaties gebruiken, omeen veelheid aan (historische) redenen, voor alleaanwezige processen dezelfde uitgangspunten enwerk¬methodiek.

Een praktische voorbeeld: de opvolging van een RFI/RFPZoals hiervoor is beschreven is het zeker niet het primaire doel omSCRUM in de meest zuivere vorm toe te willen passen. Wel wordt zoveel als mogelijk gebruik gemaakt van praktische handvatten die demethodologie biedt om processen op basis van heldere en eendui-dige uitgangspunten professioneel en maximaal effectief en efficiëntte organiseren en realiseren. Opmerkingen als ‘dat wist ik niet’, ‘Maarwat nu als we toch/alsnog op basis van deze oplossing aanbieden….’ en ‘o, ik dacht dat …’ worden hiermee voorkomen. Door het teamworden tenslotte voor in ieder geval een bepaalde periode (sprint) afspraken gemaakt op basis waarvan gewerkt wordt.De basis motivatie voor deze benadering is het creëren en behoudenvan het bewustzijn dat iedereen binnen een organisatie een rol kanspelen in de positieve afronding van projecten.

Globaal kunnen in het proces van opvolging van een RFI/RFP de volgende fases worden onderscheiden:• Initiële evaluatie van de aanvraag;• Beantwoording van de functionele en technische vragen;• Oplevering van de documentatie;• Presentatie van de organisatie, de oplossing en het voorstel;• Proces om te komen tot een overeenkomst;• Realisatie van het project;• Doorontwikkeling van de relatie.

Fase ‘0’van het projectIn deze fase worden onder andere de ‘opdrachtgever’ en de (poten-tiële) teamleden, eventueel per onderdeel/fase, bepaald. In vervolghierop worden in de eerste samenwerking tussen opdrachtgever enteam de hoofdfases benoemd.

Handvatten na Fase ‘0’Geen RFI/RFP is hetzelfde en er wordt steeds meer op basis van business cases gewerkt in plaats van (of in combinatie met) lijsten mettechnische en functionele eisen en wensen. Hierdoor wordt het steedsbelangrijker goed in staat te zijn om vat te krijgen op de werkelijkevraagstelling. Naast de standaard acties zoals het in kaart brengenvan het beslistraject en de hierbij (in)direct betrokkenen.

De WAT vraag bestaat in deze fase uit de volgende elementen (basisvoor het definiëren van de sprints in deze fase):• WAT is de werkelijke behoefte van de prospect nu en in de toekomst;

• WAT zijn de werkelijke technische en inhoudelijke wensen en eisen;

SCRUM binnen organisaties levertvoordelen op

Page 35: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

SCRUM

magazine voor software development 35

• WAT is de planning van het voortraject en de realisatie;• WAT zijn de argumenten om deze RFI/RFP in te vullen;• WAT kunnen wij bieden dat ons bijzonder maakt en onze kansenmaximaliseert;

• WAT moeten wij doen om dit project tot een succes te maken;• WAT …..

Op basis van de lijst (inderdaad er is geen enkelvoudige WAT vraag indeze toepassing te benoemen) met WAT vragen moet het antwoordworden gegeven op de HOE vragen die niet zonder meer vanuit de beschikbare documentatie kan worden beantwoord:• HOE gaan we de werkelijk behoeften, wensen en eisen in kaartbrengen;

• HOE brengen we de beslissers, beïnvloeders etc. in kaart;• HOE gaan we de beantwoording inhoudelijk en wat betreft presentatie vormgeven;

• HOE (op basis van welke oplossingen, met welke partners, etc.)geven we technisch en functioneel het beste invulling aan hetgeenin de RFI/RFP is beschreven

• ……..

Alle vragen worden gesteld en beant-woord binnen een team. Daarbij wordtvan iedereen verwacht dat die zich openen kwetsbaar opstelt. Wat voorheenvaak binnen de comfortzone van een afdeling werd besproken wordt nu gedeeld, beoordeeld en daarmee verrijkt. Door het toevoegen van de inputen invloed vanuit andere perspectievenvindt er op meerdere manieren en

diverse fronten een verbetering plaats die bijdraagt aan de kwaliteit ende uitkomst van het project.Waar de antwoorden op deze vragen bij het ‘reguliere’ gebruik vanSCRUM in de methodologie zijn ingebakken moeten deze bij het beoogde bredere gebruik van deze aanpak specifiek worden beantwoord:• Op basis van de antwoorden op de HOE vragen zal het antwoordop de WIE vragen moeten gegeven. WIE (welk TEAM) maakt zichverantwoordelijk voor welke onderdeel. In tegenstelling tot SCRUMin de zuiver vorm zal er naar verwachting sprake zijn van een wisselende samenstelling van de teams.

• Tenslotte moet het antwoord worden gegeven op de WANNEERvragen. Wanneer moet welke ‘sprint’ zijn afgerond en hoe wordt de(continue) evaluatie vorm gegeven. In tegenstelling tot SCRUM inde zuivere vorm zullen ‘sprints’ in deze toepassing per stuk in lengte kunnen variëren.Voor het managen van het proces is het logischom een SCRUM Master in te zetten. Maar wel een die begrip heeftvoor de wijze waarop het SCRUM gedachtengoed in het projectwordt gebruikt.

Een groot voordeel van het inzetten van een SCRUM Master is ook datde overgang van bijvoorbeeld de sales naar de delivery organisatie envervolgens de uitvoering van het project nog makkelijker zal verlopen.En op het gewenste kwaliteitsniveau. De borging van alle aspectendie nodig zijn voor een succesvol verloop van het project zijn tenslotte door de SCRUM Master geborgd. •

Pietwillem Overvoorde

Pietwillem Overvoorde (1964) heeftin de loop van de tijd nagenoeg allemogelijke rollen vervuld binnen(inter)nationale ICT projecten. Software ontwikkeling, businessconsultancy, project management,business development, sales- en

accountmanagement maken deel uit van zijn CV. Bij zijn werkgever, Yellowstar Solutions (www.yellowstar-solutions.nl), wordt SCRUM sinds de oprichting toegepast in alle processen. Voor bijna alle activiteiten geldt: geen lange vergaderingen maar korte, effectieve stand-ups. De zelfsturendeteams zijn verantwoordelijk voor het resultaat. In deze manier vanwerken zijn ook medewerkers van klanten betrokken. Vaak gaatdit in de eerste fase van samenwerking gepaard met een gewenningsproces; iets waarin de medewerkers van Yellowstarcoachend optreden. De praktijk heeft geleerd dat het kort op debal spelen voor alle betrokken partijen zeer effectief is.

Peter ter Braake

Peter ter Braake is sinds de zomervan 2008 zelfstandig trainer / con-sultant / MVP op het gebied vanSQL Server. Ik verzorg voor klantendatabase en Business Intelligencetrainingen. Tevens doe ik korte pro-jecten in dezelfde aandachtsgebie-den. In 2005 heb ik met een aantalmensen PASS Nederland opgericht.

PASS is de gebruikersgroep voor SQL Server. Ik ben daar momenteel vice-voorzitter en verantwoordelijk voor de events diePASS organiseert.

vervolg van pagina 31 >

Scenario’sDe feature heet niet voor niets in-memory OLTP. SQL Server kent sindsSQL Server 2012 de zogenaamde ColumnStore index. Dit is een feature die ook valt in de range in-memory features. ColumnStore isspecifiek voor datawarehouse queries. Memory optimized tables heelspecifiek niet. Als u een workload heeft met veel schrijven, en als detransactie throughput wordt beperkt door locking and latching, dankunnen memory optimized tables uitkomst bieden. Zoals gezegd ishet uitgangspunt waar gegevens leven anders (geheugen in plaats vandisk). Nog belangrijker is dat het programmeermodel anders is. Vanpessimistic concurrency met locking gaat u over op optimistic concurrency met versioning. Dat vergt een andere opbouw van uwcode. Een tweede scenario zijn de tabellen met durability opSCHEMA_ONLY. Gegevens in een database die kwijt kunnen raken?Eigenlijk een soort temp tables dus, maar dan zonder de overheadvan IO on TempDB.

ConclusieDit artikel is slechts een high level overview van memory optimizedtabellen. De belangrijkste take-away is dat er een ongelofelijke

perfomance winst valt te halen. Maar die winst is er alleen in heel specifieke situaties. En een nieuw concurrency model vergt waarschijnlijk wat aanpassingen aan uw code. •

Page 36: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

DELPHI Cary Jensen

The client application that I demonstrated made use of a TDSREST-Connection component, which was then used to import the interfaceof the TServerMethods class found on the DataSnap server. Much ofthat interface was designed to demonstrate FireDACJSONReflect, aset of classes and interfaces designed to wrap and unwrap data foruse with FDMemTables in the client application.I bring up that presentation as a starting point for a discussion aboutREST clients, client applications that connect to data using HTTP. Iam not going to get into a detailed discussion of FireDACJSONRe-flect, as that is just one of many possible ways to wrap data that isconsumed by a REST client, and one that is somewhat limited, in thatit more or less requires a Delphi client. Instead, I am going to use thatserver to demonstrate some of the REST-related tools that have shipped in Delphi since Delphi XE5. These include the REST Debugger and the REST Client Library But before we do that, it is necessary to first understand some features of the DataSnap server.

The DataSnap Server Methods exposed by a REST-based DataSnap server are those methods associated with the TServerMethods class. When you usethe DataSnap Server wizard from the Object Repository, you have theoption of creating this class as a TComponent, a TDataModule, or aTDSDataModule. So long as you are not using the server to exposeTDataSetProviders, it really doesn't matter which one you pick. Personally, I prefer either the TDataModule or TDSDataModule opti-ons, as they provide a design surface on which to place components.If your DataSnap server is data-aware, as this one is, these compo-nents will be associated with connecting to a database and executingqueries. Figure 1 shows how my DataSnap server methods data module looks like in Delphi's designer. Note that some of the compo-nents on this data module, such as the TFDStanStorageBinLink andthe TFDStanStorageJSONLink, are there to support FireDACJSONReflect, and not necessarily required by a DataSnap REST server.

Fig. 1: The server methods data module in the designer

Here is the declaration of the TDSDataModule class, showing some ofthe methods exposed through this class (for the most part, I am onlyshowing the methods that I will be calling in the clients I discuss laterin this article). The methods being exposed are those found in the public section of the class declaration.

type

TServerMethods1 = class(TDSServerModule)

CustomerQuery: TFDQuery;

FDConnection1: TFDConnection;

FDStanStorageBinLink1: TFDStanStorageBinLink;

FDStanStorageJSONLink1: TFDStanStorageJSONLink;

OrdersQuery: TFDQuery;

CustomerOrdersQuery: TFDQuery;

private

{ Private declarations }

public

{ Public declarations }

function EchoString(Value: string): string;

function ReverseString(Value: string): string;

function EchoStringRaw(Value: string): string;

function ReverseStringRaw(Value: string): string;

function GetCustomerCDSRaw: string;

end;

EchoString and ReverseString are the sample methods generated bythe DataSnap Server wizard, and they return a JSON result. The othermethods are custom methods whose names ends with Raw. Thosemethods return a custom string that does not necessarily wrap theresult in a JSON object.

I don't want to focus too much on the implementation of these methods, instead permitting you to learn more about them by

MAGAZINE

36

Delphi's REST Debugger andREST Client Library, Part 1At SDN's Software Development Conference in Papendal this December I presented a sessionon DataSnap and REST using FireDAC. In that presentation I demonstrated a DataSnap serverthat used FireDAC FDMemTables to create special data streams that could be delivered to clientapplications written in Delphi, and from which specialized streams containing a user's updatesto the data could be returned. Importantly, the client/server communication made use of HTTP(hypertext transfer protocol) requests and JSON (JavaScript Object Notation), two elementscentral to a distributed application style typically referred to as REST (REpresentational StateTransfer).

REST = REpresentational State Transfer; JSON = JavaScript ObjectNotation

Page 37: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

DELPHI

magazine voor software development 37

examining the source code from the download I will reference later inthis article. However, permit me to show two methods: EchoString,and EchoStringRaw, so that you can see the basic difference betweenhow Delphi's default server returns data (EchoString) and how youcan take control over the returned content.

function TServerMethods1.ReverseString(Value: string):

string;

begin

Result := System.StrUtils.ReverseString(Value);

end;

function TServerMethods1.ReverseStringRaw(Value: string):

string;

begin

//Must use the DBXPlatform unit for GetInvocationMetadata

GetInvocationMetadata().ResponseCode := 200;

GetInvocationMetadata().ResponseContent :=

System.StrUtils.ReverseString(Value);

end;

GetInvocationMetadata is discussed later in this article.

DataSnap Servers and SecurityThis DataSnap server implements security through secure socket layerand, optionally, through authentication. Since both of these featuresimpose requirements for any REST client application, permit me tospend a moment explaining this in more detail.Secure socket layer, or SSL, is implemented in DataSnap usingOpenSSL. OpenSSL is an open source technology used to provideencrypted communications between a server (which is an HTTP server in this case) and an HTTP client. The HTTP client could potentially be any client, such as a Delphi application, a Web browser,or a mobile application employing JavaScript.

For this demonstration, I created an SSL certificate using OpenSSL.This process is described by Paweł Głowacki, Embarcadero's European Technical Lead for Delphi and RAD Studio technologies, inhis blog found at:http://blogs.embarcadero.com/pawelglowacki/2013/10/16/40089.

When you download and install OpenSSL, and then run the batch fileprovided by Pawel in his blog, you can generate a certificate that is suitable for testing, but not for deployment. In order to create a certificate for deployment, you need to purchase one from a trustedcertificate authority, such as Symantec, Thawte, or GoDaddy.In order to simplify your use of the DataSnap server demo, I have included a directory containing the certificate files that I generated.

Since the path to these files must be defined before the server starts,I insert a reference to the certificate files upon creation of the data module that holds the DataSnap-enabling components. This class isreferred to as the server container unit, and the relevant code is shownin the following code segment.

{$DEFINE UseAuthentication}

var

AppDir: string;

procedure TServerContainer1.DataModuleCreate(Sender: TOb-

ject);

begin

AppDir := ExtractFilePath(ParamStr(0)) + 'keys\';

DSCertFiles1.CertFile := AppDir + 'MyDataSnap.pem';

DSCertFiles1.KeyFile := AppDir + 'MyDataSnap.key';

{$IFDEF UseAuthentication}

DSHTTPService1.AuthenticationManager := DSAuthenticati-

onManager1;

{$ENDIF}

end;

As you can see from this code, there is a conditional define that canbe used to turn on or off authentication. This allows me to easily enabled or disable authentication, and then show how doing so affects the client applications. When authentication is turned on, thefirst attempt by a client to connect to the DataSnap server will be challenged for a username and password. This is handled by the OnUserAuthenticate event handler associated with the TDSAuthenti-cationManager component. In my simple demonstration I am only requiring the user to enter the password Delphi, as you can see fromthe following event handler.

procedure TServerContainer1.DSAuthenticationManager1UserAu-

thenticate(

Sender: TObject; const Protocol, Context, User, Password:

string;

var valid: Boolean; UserRoles: TStrings);

begin

valid := Password = 'Delphi';

end;

Because the primary concern of this article is about REST clients, I have described as much as I intend to about the DataSnap server.

REST ClientsAs mentioned earlier, REST clients come in a variety of flavors. Let'sbegin by using one of the more ubiquitous, the everyday web browser.

Making REST Calls using a BrowserTo begin with, you need to run the DataSnap server. In this first demonstration, the UseAuthentication define is commented out, meaning that only SSL encryption is used.Let's start by calling the ReverseString method. Since my server is listening on port 8081, and I am using the default DSContext andRESTContext properties of the TDSHTTPService component in theserver container unit, and my server methods class name is TServer-Methods1, I can call ReverseString, passing the string "Delphi," usingthe following URL: https://localhost:8081/datasnap/rest/tservermethods1/Reverse-String/Delphi

Note: If you are using OpenSSL onyour server, you should ensure thatyou are using a recent version of theOpenSSL libraries (libeay32.dll andlibssl32.dll). Older versions ofOpenSSL contain a vunerabilitynamed heartbleed

Page 38: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

DELPHI

MAGAZINE

38

Since I have used a custom (some would say phoney) SSL certificate,Internet Explorer balks at my attempt to go to this URL, instead warning me of a potential problem, as shown in Figure 2.

Fig. 2: IE warns that the custom certificate was not issued by a trusted certificate authority

Since I know that there is no threat, I click Continue to this website. So long as the browser is open, this is the last time I am going to haveto verify that I want to go to this URL. Having accepted the risk, IE now shows the value returned by the call to ReverseString, as shown in Figure 3.

The value shown in Figure 3 is a JSON object containing a singlename/value pair. As you can see, the name is result. The value part isa JSON array, and this is where all of the data returned by a REST callto a DataSnap server will appear, by default. In some cases, such aswhen you return a data set, this array can contain a great deal of data.

Fig. 3: The JSON object returned by DataSnap

There might be some cases where you do not want to use the defaultformat employed by DataSnap. In that case you can use a techniquelike that shown in the implementation of the ReverseStringRaw method. There I've used the TDSInvocationMetadata object returnedby the GetInvocationMetadata function to return a string without wrapping it in a JSON object. This permits me to create my own string,even one that represents a JSON object using a different format. Figure 4 shows the text returned by the call to ReverseStringRaw,which is simple text in this case.

Fig. 4: You can return custom formats using a TDSInvocationMetadata object

Things are a little different if we invoke our methods with authentica-tion enabled. In that case, the first time we invoke one of the methodson the DataSnap server, in other words, the first time we touch theDataSnap server through HTTP, we are challenged for a usernameand password, as shown in Figure 5.

Since my implementation of the OnUserAuthenticate event handleronly requires a password of Delphi, so long as I provide the passwordDelphi (a case-sensitive string), the method being invoked will returnits value. If I do not pass a valid username/password pair, the brow-ser will display an error, and the call to the REST method will fail.

Fig. 5: A username and password is requested prior to connectingto the DataSnap server

Authentication happens the first time you touch a given DataSnap server from a given client. Authorization, by comparison, happensupon each and every REST method invocation. You use authorizationto implement role-based permissions, either permitting or denying aparticular user the right to invoke the method they are trying to call. Afurther discussion of authorization is beyond the scope of this article.

Calling REST Methods Using the REST DebuggerIntroduced in Delphi XE5, Delphi's REST Debugger is a stand aloneapplication that permits you to test calls to REST services. In it's simplest form, you enter a URL with a correctly formed REST invocation into the REST Debugger and then click Send Request. Figure 6 shows how the REST Debugger looks after sending the samerequest used in Figure 3 to the DataSnap server. In this figure, theBody tab of the Response pane is selected, displaying a formattedview of the returned JSON.

Fig. 6: The REST Debugger executes the same URL as shown inFig.3.

Entering the full URL for the invocation of the REST method in the URLfield of the Request tab of the Request pane is convenient. However,when you later move to the REST client components in Delphi it isbetter to partition the pieces of the request URL between the baseURL and the specific method invocation segment. Specifically, all ofthe methods from the DataSnap server being used in this sample havethe same base URL, as shown here:

https://localhost:8081/datasnap/rest/tservermethods1

Page 39: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

DELPHI

magazine voor software development 39

resource and parameter value assignments are combined with the base URL defined on the Request tab (this base URL is set to thestring shown earlier in this section).

The REST call shown in Figure 6 was performed against the Data-Snap server using SSL, but not authentication. (Since this DataSnapserver only permits HTTPS calls (SSL), a call using HTTP would fail. Ifyou have downloaded the code samples, you can test this for yourself.) If your REST server requires authentication, you use the Authentication tab of the Request pane to provide the require information before clicking Send Request. Figure 8 shows a usernameand password entered into the Authentication tab, and the resultingresponse from the server. The password is masked in the figure, buttrust me that I entered Delphi.

I've used BASIC authentication in this case, which inserts the user-name and password into the HTTP header. This is how the DataSnapserver is expecting to receive this data when authentication is imple-mented. There are three additional authentication methods. SIMPLEpasses the user name and password in a manner similar to how youwould pass a username and password field from an HTML form. Thelast two, OAUTH and OAUTH2, use the corresponding protocol forOAuth. OAuth is an open standard for delegated authorization, permitting a site to accept access tokens from a third party service, forexample, authorizing access to a site using the user's Facebook orGoogle account.

The REST Client LibraryIn addition to the REST Debugger, the release of Delphi XE5 also sawthe introduction of the REST Client Library, a set of cross-platformcomponents that you can use from any of Delphi's supported plat-forms. In this section I will focus on four of these: TRESTClient, TRESTRequest, and TRESTResponse. I will also talk about the authentication components, but only in passing.

At a minimum, a REST request requires that you use a TRESTClientand a TRESTRequest. The TRESTClient takes responsibility for theHTTP communication to the REST server, and also holds the RESTservice end point, or base URL. Most applications need only oneTRESTClient for each REST service to which it will connect.

In most applications you will have one TRESTRequest for each method you want to execute. A given TRESTRequest object holds theresource definition for the corresponding method using the format described in Figure 7, as well as any parameters, which are used toassociate values with each of the names that appear in the resource.The Client property of each TRESTRequest must point to a properlyconfigured TRESTClient component.

The use of TRESTResponse is optional. You use this component ifyou want to persist any data returned from a TRESTRequest. TheTRESTRequest in question is the one whose Response propertypoints to the TRESTResponse.

If you execute a TRESTRequest, and its Response property does notpoint to a TRESTResponse, a TRESTResponse is created on-the-fly,and you can access it using the Response property of the TRESTRe-quest any time after the successful execution of the TRESTRequestand prior to freeing the TRESTRequest or clearing its content by cal-ling ResetToDefaults.

The use of TRESTClient and TRESTRequest is demonstrated in theRESTClientDemo project, whose main form is shown in Figure 9. Thisproject invokes three of the methods exported by the DataSnap RESTserver (the methods being invoked should be pretty obvious). There isa single TRESTClient, which points to the base URL of the DataSnap

The remainder of the URL specifies the method to invoke and any required parameters. The REST Debugger can accept the methodname and its parameters in a property it calls the resource, where theresource specifies the method to be invoked, and, if the method requires one or more parameters, defines named placeholders, one foreach parameter. With respect to the ReverseString method being invoked in Figure 6, this resource looks something like this:

ReverseString/{Value}

In this resource, ReverseString specifies the method to be invoked,and the single required parameter is represented by a name withincurly braces. The actual name used for a particular parameter is irrelevant, just so long as it is unique within the resource. Specifically,that I've used the name Value in the resource has nothing to do withthe fact that the formal parameter name of the single parameter of theReverseString method is called Value. I could have used somethingelse.

Fig. 7: You use the Parameters tab of the Request pane to define theresource and assign values to your named parameters

If you enter a base URL in the URL field of the Request tab of the Request pane, you use the Parameters pane to enter the resource,after which you assign a value to each of the parameter placeholdersappearing in the resource. This can be seen in the Figure 7, where the

Fig. 8: With Authorization turned on, you need to pass a username and password to the server

Page 40: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

DELPHI

MAGAZINE

40

server. In addition, there are three TRESTRequest objects, one foreach of the methods that are invoked.

Fig. 9: The main form of RESTClientDemo

In this particular project there was no need to employ a TRESTResponse component, since the returned data is already being persisted in the application's user interface. For the ReverseString andReverseStringRaw REST calls, the data is being stored in a memo.The value returned by GetCustomerCDSRaw is being stored in aClientDataSet.

There is an additional REST client component on this form, theTRESTBasicAuthentication component. This component, and its proper configuration, is required if your REST service implements authentication.

Here are the three event handlers, each one associated with one of thebuttons that appear on the left side of this form. Each event handler assigns values to the named parameters in the associated TRESTRequest.Resource properties, with the exception of GetCustomerCDSRaw, which has no parameters.

procedure TForm1.ReverseStringBtnClick(Sender: TObject);

begin

RRReverseString.Params.ParameterByName('ValueToReverse').Valu

e :=

ValueToReverseEdit.Text;

RRReverseString.Execute;

ResponseMemo.Lines.Text := RRReverseString.Response.Con-

tent;

end;

procedure TForm1.ReverseStringRawBtnClick(Sender: TObject);

begin

RRReverseStringRaw.Params.ParameterByName('ValueToRe-

verse').Value :=

ValueToReverseEdit.Text;

RRReverseStringRaw.Execute;

ResponseMemo.Lines.Text := RRReverseStringRaw.Response.Con-

tent;

end;

procedure TForm1.GetCustomerDataBtnClick(Sender: TObject);

var

cds: TClientDataSet;

begin

if DataSource1.DataSet <> nil then

DataSource1.DataSet.Free;

cds := TClientDataSet.Create(Self);

RRGetCustomerCDS.Execute;

cds.XMLData := RRGetCustomerCDS.Response.Content;

DataSource1.DataSet := cds;

end;

Figure 10 shows the running application. In this figure, both the ReverseString and Get Customer Data buttons have been pressed.

Fig. 10: The running RESTClientDemo application

You can download the code sample for this article from the followingURL: http://www.JensenDataSystems.com/sdnmag_rest.zip

SummaryIn this article I have introduced the REST Debugger and several of thecomponents of the REST Client Library. In the next issue of the SDNMagazine I will demonstrate more capabilities of the REST debugger,as well as show how to use the REST Debugger and REST Client Library on REST services other than DataSnap. •

Cary Jensen

Cary Jensen is Chief Technology Officer of Jensen Data Systems.Since 1988 he has built and deployed database applications in awide range of industries. Cary is anEmbarcadero MVP, a best selling

author of more than 20 books on software development, andholds a Ph.D. in Engineering Psychology, specializing in human-computer interaction. His latest book is Delphi in Depth: Client-DataSets 2nd Edition. You can learn more about this book athttp://www.JensenDataSystems/cdsbook2.

OPROEP!

Lijkt het je leuk een bijdrage te leveren aan (het volgende) SDN magazine?We nodigen je van harte uit om een artikel te schrijven over je vakgebied,over ontwikkelingen en/ of achtergronden. Stuur je kopij naar [email protected], er zit een auteur in ons allemaal!

Page 41: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

TFS Wouter de Kort

DevOps, Application Lifecycle Management, Agile. Het zijn termen die we allemaal kennen. Maar hoe past een tester binnen dit verhaal?We weten allemaal dat Microsoft voor developers erg goede toolingheeft. Teams gebruiken vaak versie beheer, build servers en projectmanagement tooling in TFS. Sommige teams gaan echt al richtingcontinuous deployment door bijvoorbeeld Release Management tegebruiken. Maar hoe zit het met testers? Worden zij ook ondersteund?Vaak zie ik testers hun test cases nog bijhouden in Excel. Of ze gebruiken totaal andere tooling van bijvoorbeeld HP of Tosca zonderverder echt te integreren met de ontwikkelaars. Testers zijn veel tijdkwijt aan het handmatig uitvoeren van test cases en het bijhouden vanvoortgang. Maar als je echt naar continuous delivery wilt, kan een nietefficiënt test proces een steeds groter probleem worden.

Eén van de best bewaarde geheimen van de Microsoft ALM tooling isMicrosoft Test Manager (MTM). MTM is voor testers wat Visual Studiovoor ontwikkelaars is. Door testers MTM te laten gebruiken integrerenze helemaal in het ALM proces.In dit artikel wil ik een paar van de mogelijkheden van MTM besprekendie mij enthousiast hebben gemaakt en die jou kunnen helpen om mettesters binnen je organisatie in gesprek te gaan.

Ontmoet Microsoft Test ManagerAls ontwikkelaars gebruiken we Visual Studio. Project managers gebruiken de web-interface van TFS en Excel. Testers gebruiken Microsoft Test Manager. MTM is speciaal gemaakt voor testers.

De applicatie is een stuk eenvoudiger te gebruiken dan Visual Studio en helpt testersecht om hun werk gedaan te krijgen.

MTM is een onderdeel van Visual Studio Test Professional. Je kunt een gratis 90 dagen trial downloaden op http://www.visualstudio.com/products/visual-studio-test-professional-with-msdn-vs

Fast forwarding van testsIn plaats van Excel lijstjes te gebruiken laat MTM testers hun tests bij-houden, organiseren en delen met het team als een echt onderdeelvan TFS. Figuur 1 laat een test case zien zoals die er in MTM uitziet.

Fig. 1: Een test case in MTM

Hier zie je een test case met een aantal stappen en het verwachte resultaat. Als een tester deze test case nu gaat draaien verschijnt deinterface in Figuur 2 bij de tester op zijn scherm. Tijdens het afspelenvan de test kan de tester hierin direct bijhouden welke stappen goedgaan, eventueel commentaar toevoegen of direct een bug inschietenin TFS.

Terwijl de tester zijn test case uitvoert, helpt MTM door de acties vande tester op te nemen. Stel bijvoorbeeld dat je een wizard test waar-bij je verschillende velden moet invullen om door te kunnen naar devolgende stap. MTM helpt je door het invullen van de velden op tenemen en de volgende keer dat je deze test case uitvoert kun je automatisch doorspoelen en worden alle velden automatisch voorje ingevuld.

Stel je eens voor hoeveel tijd dit een tester bespaart. In plaats van iedere keer handmatig alle stappen herhalen kan de tester de minderbelangrijke stappen nu doorspoelen en zich focussen op de stappendie echt interessant zijn.

magazine voor software development 41

Ken jij Microsoft Test Manager?At SDN's Software Development Conference in Papendal this December I presented a sessionon DataSnap and REST using FireDAC. In that presentation I demonstrated a DataSnap serverthat used FireDAC FDMemTables to create special data streams that could be delivered to clientapplications written in Delphi, and from which specialized streams containing a user's updatesto the data could be returned. Importantly, the client/server communication made use of HTTP(hypertext transfer protocol) requests and JSON (JavaScript Object Notation), two elementscentral to a distributed application style typically referred to as REST (REpresentational StateTransfer).

Page 42: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

TFS

MAGAZINE

42

Dit soort opnames zijn dan weer de basisvoor volledig geautomatiseerde testen diebijvoorbeeld door de build server of tijdens een automatische deployment gedraaid kunnen worden zodat er nogmeer tijd bespaart wordt.

Data CollectionNaast dat MTM de acties die een testeruitvoert kan bijhouden, kan er nog veelmeer data automatisch verzameld worden. Standaard wordt er bijvoorbeeldbijgehouden op wat voor systeem detester zijn werk doet zoals Windowsversie, gebruikte browser en systeemspecificaties. Maar zoals Figuur 3 laat zienis er veel meer mogelijk. Met één simpel vinkje kun je hier bijvoor-beeld een video opname maken van hetscherm van de tester en eventueel zelfsaudio opnamen. Of wat dacht je van IntelliTrace data, event logs en code coverage info? Al deze data wordt gekoppeld aan het test result en toegevoegd aan bugs die de tester inschiet. Dus als ontwikkelaar heb je nueen stappenplan van wat de tester heeftgedaan samen met allerlei data waaron-der zelfs een video opname.

Fig. 3: Data Collectors

Een andere optie die zeker interessant is, is Test Impact analysis. Als je je test omgevingen ook koppelt aan TFS, is TFS instaat om teanalyseren welke code er tussen verschillende builds is gewijzigd enwelke test cases daar dan weer bij horen. Op deze manier krijgt eentester dus een overzicht van de test cases die het belangrijkste zijnom te draaien voor een nieuwe versie van de applicatie.

Exploratory TestingTot nu toe hebben we vooral gekeken naar het gebruik van vooraf geschreven test cases. Maar wat nu als je in een Agile proces dezetest cases nog niet hebt gemaakt? Of wat als je als ontwikkelaar ofstakeholder gewoon even door de applicatie heen wilt gaan om te kijken of bepaalde dingen werken? En natuurlijk wil je dan, dat als hetmis gaat je ook nog kunt reproduceren waar de fout zit.Dit is waar je Exploratory Testing voor gebruikt. Als je een ExploratoryTesting sessie begint vanuit MTM, heb je geen voor gedefinieerd test

plan tot je beschikking. In plaats daarvan ga je naar eigen inzicht doorde applicatie heen terwijl ondertussen MTM alles bijhoud wat je doet.Vind je dus een bug, dan kun je rechtstreeks vanuit je Exploratory Tes-ting sessie een bug aanmaken met daaraan gekoppeld de stappendie je hebt gedaan en eventueel weer info zoals een video opname,Event Log, System Information of IntelliTrace data.

Als je naar Figuur 4 kijkt zie je een bug die is aangemaakt vanuit eenExploratory Testing sessie. Als je kijkt naar de Steps To Reproduce zieje dat MTM precies heeft bijgehouden welke acties de gebruiker heeftuitgevoerd. De andere tabs geven extra info die allemaal in TFS wordtopgeslagen.

Fig. 4: Bug vanuit Exploratory Testing

MTM is cool!Dit zijn maar een paar features van MTM waar ik enthousiast van werd.Maar er zijn er nog veel meer. Denk bijvoorbeeld aan het gebruik vanparameters in test cases, rapportages over je voortgang, het gebruikvan verschillende systeem configuraties voor testen (bijvoorbeeldWindows 7 en 8, of IE en Chrome) en nog veel meer.

Beginnen met MTM is eenvoudig. Download gewoon de trial en koppel deze aan een gratis Visual Studio Online account zodat je meteen kunt beginnen. Als je wat gerichter met MTM aan de gang wiltkun je ook de Brian Keller Virtual Machine downloaden compleet metHands On Labs die je alles van MTM laten zien. •

Wouter de Kort

Wouter begon met software ontwik-keling toen hij 7 was. Hij werkt nu alsLead Microsoft ALM Consultant bijOrdina waar hij leiding geeft aan eenteam van ALM Consultants. Wouterhelpt organisaties om voorop te blij-ven met alle ontwikkelingen op de

Microsoft Stack. Hij richt zich vooral op Application Lifecycle Management en software architectuur. Hij houdt er van om com-plexe problemen op te lossen en anderen nieuwe dingen te leren.Wouter heeft een paar boeken geschreven, is een Microsoft Cer-tified Trainer en ALM Ranger. Je kunt hem vinden op Twitter(@wouterdekort) en op zijn blog http://wouterdekort.blogspot.com

Fig. 2: Uitvoeren van een testcase

Page 43: SDN Magazine 124 · 19 Microservices. The good, the bad and the ugly Sander Hoogendoorn 23 Improving traceability of distributed systems using the ELK stack Patrick Kalkman 30 SQL

CLOUD Marcel Meijer

Daarom zijn er ook leveranciers die hun backoffice via API’s beschik-baar stellen aan de wereld. Meestal wil je dat niet zonder pardon doenen wil je er als leverancier wellicht geld aan verdienen. Dus je wil eenDeveloper portal maken met verschillende groepen, help pagina’s,voorbeeldcode, monitoring, issue lijst, FAQ, maar ook malafide gebruikers/applicaties blacklisten. Kortom het vergt meer dan evenhet beschikbaar stellen van een paar webservicesje.Enige tijd geleden had ik ook zo’n droom. Ik wilde voor de SDN eenevaluatie app maken. Bezoekers van een SDN event kunnen dan mobiel een evaluatie formulier invullen. Deze evaluatie data wordt ineen data store op Azure bewaard. Uiteraard wil ik niet mijn tokens/connectionstrings/passwords etc in mijn mobiele apps opslaan. En aangezien ik niet voor elk device zelf een applicatie kan schrijven,deze gegevens delen met wildvreemde developers.

Dus bedacht ik dat ik een aantal Webapi services beschikbaar moest stellen. Maarzoals hierboven genoemd, had ik behoefteaan eer developers portal om mijn servicesuit te leggen en wat ze opleveren. Dat is veel

werk voor zo’n API als dit. Dit is mijn landingspagina nu; http://sdnevalapp.azurewebsites.net/.

Gelukkig is daar een oplossingvoor op het Azure platform. DeAPI management service (docu-mentatie site). Als je de servicegemaakt hebt, dan is er eenaparte portal (https://marcel-meijer.portal.azure-api.net/admin) waar je alle instellingen

doet, waar je de metrics van je API ziet, de applicaties die aangemeldzijn, welke API het vaakst aangeroepen wordt etc.

Bij de settings kun je dan dewebservices beschikbaar stel-len. De verschillende operaties,welke http verb, welke respon-ses er verwacht kunnen worden, welke URL, omschrij-ving en helpteksten. De URLnaar de bron services kan ookon-premises gehost worden.

Uiteraard is het dan wel verstandig om de endpoints op deze URL tebeveiligen met een Certificaten, UserName/Password combinatie ofvia OAuth.Dit is de management portal voor de beheerder van deAPI(https://marcelmeijer.portal. azure-api.net/admin), voor de ontwik-kelaars is er een aparte portal (https://marcelmeijer.portal.azure-api.net/). Deze kan tot op zekere hoogte ook gestyled en aangepastworden. Deze Developer portal is redelijk compleet. Alle genoemdezaken zijn hier wel te vinden.

Zo is er een handig overzicht van de beschikbare API’s.Van de beschikbare API kun je de beschikbare endpoints zien. Je zietdan de omschrijving en de URL om API aan te spreken. Om het end-point te gebruiken moet je een subscription key meegeven. Het heleidee van deze portal is dan ookom gebruik te reguleren en metbehulp van de subscription keyis de API per applicatie/ontwik-kelaar apart. Aangezien de end-points aan de basis beveiligdzijn met Certificaten, Username/Passwords of via OAuth, heefthet geen zin om rechtstreeksnaar de bron te gaan.Op deze Developer portal kun jeAPI methode ook uitproberenen de verschillende gedefini-eerde HTTP acties uitvoeren. Jekrijgt dan de trace en het resul-taat te zien.

Helemaal onderaan de paginakun je per programmeertaalvoorbeeldcode krijgen. Alles omde ‘klanten’ van je API te ondersteunen en te helpen.

Door deze Azure service kun je je richten op het echte leuke en belangrijkste van de API, de functionaliteit. Waarom zou je het zelfdoen, als je gebruik kunt maken van de expertise van andere. “You can reach further while standing on the shoulders of giants”. •

magazine voor software development 43

API ManagementHet is voor leveranciers van producten bijna onmogelijk om voor ieder platform mobiele applicaties te maken. Natuurlijk kun je dan als leverancier zorgen voor een goede responsievemobiele website. Het nadeel van deze manier is dat je de capaciteiten en mogelijkheden van eenmobiel device niet volledig uit nut.