Playing with Quarkus

It is vacation time, so why not try something new? I’ve been playing around with Quarkus a bit. It is incredibly cool to get native code from Java with blindingly fast startup times, but it makes me remember the old days with C++. Building the simple toy application in the getting started tutorial takes ages and the first few times it failed as the build ran out of memory. Increasing the memory reserved for Docker to 8G helped, but build times are still very long.

To get the startup times of C++ we are stuck with the build times of C++. Perhaps not surprising, but there it is.

Categories: Docker, Java

The right time to throw out JUL

There is an old Swedish saying: tjugondedag Knut åker julen ut. JUL is Christmas in Swedish and on this day, twenty days after Christmas Eve, we celebrate the end of Christmas, i.e. end of JUL. It was thus with great pleasure we got rid of JUL (java.util.logging) from one of our Java projects Today in favor of YAL (Yet Another Logger alias System.Logger that shipped with Java 9). The timing could not have been better.

Categories: Java

ZFS on Linux with native encryption finally released

The title really says it all, was released 13 hours ago. Check it out!

Categories: Linux

Quick guide to typeperf for Windows performance monitoring

The typeperf command is an underused gem in the Windows world. It is basically iostat/vmstat/sar for Windows on steroids and is available out of the box from Windows 2000 and up.

With typeperf it is possible to sample any performance counter on the local computer or by all means remotely and write it to the console or to a file at a specified rate, by default once per second. That is perfect when you want to instrument something during a performance test and keep the raw data afterwards.

To get the names of the available counters, run:

typeperf -q >counters.txt

This gets all the installed counters without instances. The same command but with -qx gets the counters with instances. An example of a counter with an instance is \Process(notepad)\% Processor Time which gets the processor time for the notepad process specifically. Without instances notepad becomes *.

To write to a file, include -o. To change the sample rate, use -si. To stop after a given number of samples, use -sc. To connect to another computer, use -s.

To check the total processor time every second:

typeperf "\Processor(_Total)\% Processor Time"

Available memory every ten seconds:

typeperf "\Memory\Available Bytes" -si 10

Pid, processor time and working set for notepad every second (no newlines):

typeperf "\Process(notepad)\ID Process"
  "\Process(notepad)\% Processor Time"
  "\Process(notepad)\Working Set"
  "\Process(notepad)\Working Set - Private"

Disk queue length every second :

typeperf "\PhysicalDisk(*)\Avg. Disk Queue Length"

This just scratches the surface. Happy monitoring!

Categories: Windows

Delete StatefulSet in Kubernetes fails with NotFound

I have created a stateful set with MongoDB databases in Kubernetes with AKS. In order to test the persistent volumes I tried to delete it, but to my surprise that failed:

Error from server (NotFound): the server could not find the requested resource

What? Getting the resource worked, but kubectl describe failed. What to do? I finally found out that my kubectl client was incompatible with the server. Apparently Kubernetes supports one version higher or lower, but kubectl is at 1.10 and the server at 1.8.

Categories: Kubernetes

Terminal in docker exec a mess

Fairly recently the terminal for docker exec has started to misbehave. When I enter a running Wildfly container to view the logs the output becomes garbled with less, vi and other tools. It appears the reason is that the terminal size is not detected (#33794). The solution on Linux/Mac is to pass in the size:

docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it imagename

Unfortunately that doesn’t work on Windows. The mode command can provide the columns, but not the number of lines, which must be hard-coded.

Categories: Docker

Azure SQL Server VM backup failures

SQL Server VMs in Azure can be backed up using the SQL Server configuration blade in the portal. When this has been enabled the logs can be swamped by errors similar to:

2018-06-04 11:44:59.88 Backup BACKUP failed to complete the command BACKUP LOG master. Check the backup application log for detailed messages.

Fear not, it is only temporary. A SQL Server backup consists of two parts: a full backup of the database(s) and transaction logs. When no full backup has been done the transaction log backups fail with the error above. The errors should go away when the first full backup has been completed successfully.

As a side note there is no “application log”, the message refers to the calling application and in this case that is the Azure SQL Server extension. It doesn’t log anything useful.

Categories: Database

Biztalk 2016 wants to disable private key protection

Biztalk 2016 failed to receive AS/2 messages with this error:

The MIME encoder failed to sign the message because the certificate has private key protection turned on or the private key does not exist. Please disable private key protection to allow BizTalk to use a certificate for signing.

Sounds straightforward except that private key protection was disabled already. And the user profile for the Biztalk user was loaded, nothing wrong there. I went through the documentation several times, nothing wrong. Finally I found that it was the cryptographic provider.

Basically the problem is that Biztalk 2016 still relies on the ancient .NET 3.5, which lacks support for KSP. Check the certificate:

certutil -p password cert.pfx

If it says “Provider = Microsoft Software Key Storage Provider” then Biztalk will fail and complain about private key protection. Fix it with openssl:

openssl pkcs12 -in my-original-cert.pfx -out temp.pem
openssl pkcs12 -export -in temp.pem -out my-fixed-cert.pfx

Import my-fixed-cert.pfx to the personal certificate store (and if self-signed also import as CA key). Update Biztalk to use the updated certificate and hopefully the problem should be solved. If you are starting from scratch, specify the old provider instead:

New-SelfSignedCertificate -Provider "Microsoft Strong Cryptographic Provider" ...
Categories: Windows

Install .NET 3.5 on Windows Server 2016 for Biztalk

Why would Windows Server 2016 need .NET 3.5? Well, ask Microsoft as it is needed for Biztalk 2016, a product that also requires an old SQL Server version (will not install on 2017) with Windows authentication. Anyway, put that aside. We need it and it should be a simple thing to add the feature. Unfortunately it is not. The wizard complains that it can’t find the files.

After some digging I managed to get it to work. First of all, open the group policy editor (gpedit). Navigate to Local Computer Policy -> Computer Configuration -> Administrative templates -> System -> Specify settings for optional component installation and component repair. Change the option to Enabled with “Download repair content…” on. Exit the application and run in a command prompt as administrator:

dism /online /enable-feature /featurename:NetFX3 /all /LimitAccess

Hopefully that should do the job. Phew!

Categories: Windows

Azure AKS default VM size cannot be changed

Kubernetes is pushed by all the major cloud provider and Microsoft recently (well, end of 2017) rolled out managed Kubernetes, AKS. It is a great offering, but there are problems. This is to be expected from a product that is still in preview, but take care and expect a somewhat bumpy ride if you take the leap!

Create a new cluster, for example with:

az aks create --resource-group rgakstwe \
 --name akstwe \
 --node-count 2 \
 --ssh-key-value ~/.ssh/ \
 --location westeurope

This creates two nodes with the default AKS VM size, at this point Standard_D1_v2. All is well, but what happens when you want to add persistent volumes? Unfortunately premium storage disks are available only for some VMs. In particular they are NOT available for Standard_D1_v2, so while it is possible to create a persistent volume claim it is not possible to run a deployment that uses it.

What to do? There is no az aks update command for changing the VM size. According to Microsoft the only way forward is to manually change the size for each individual VM. That works, but there is a problem: the default size will be used when the cluster is scaled, so if it scales down and then up again the manually tweaked nodes revert to the default VM size.

At present that is the way it is. When AKS exits preview and is rolled out for real there will be a way to change the default VM size, but for now it is important to think ahead as the only way to change the default which is used for scaling is to recreate the cluster.

In other words, plan ahead and don’t start too small.

Categories: Kubernetes