Tuesday, May 21, 2019

Increase LOG_FILE_MAX_SIZE_TRUNCATE using INETMGR

We might have encountered the below message in FREB logs when the log size goes above the size limit.


Simple google tells us how to increase the size by executing the below command.

cd /d "%windir%\system32\inetsrv" appcmd set config /section:sites -siteDefaults.traceFailedRequestsLogging.maxLogFileSizeKB:1024

This works for most of us. This post is to show how this can be done via INETMGR application which is just a UI around the commands to manage IIS Web server.
There is no direct way to edit it with customized view. But we can select the server node and navigate to the settings using Configuration Editor icon under Management section.

Tuesday, May 14, 2019

Hard drive shows full but size not reflected in the folder properties

Recently, we were doing load testing of an enterprise application. We use VisualStudio load testing project now known as Azure DevOps with 4 agents having 16 cores, 64GB each. Due to some enterprise restrictions we are not able to use the VSO / DevOps hosted agents instead we have to use 'bring your own agent' method. It was fine when we were below 3000 virtual users limit. But when we targeted 5000 users, we ended up in load test agent issues than the application.

One of the issues was a failure in load test run saying there was not enough hard disk space. When I went into the machine using my login, I could see the "This PC" page shows the c:\ drive is full. But when I select all folders inside c:\ and check the properties, it doesn't shows the same disk usage!!!

Which folder is filled up? Any magic going on here?

It was interesting as the properties shows low usage where drive shows full even I am admin in the load agent machine.

Fortunately, we have Microsoft support and they were in the meeting. They pointed out to windirstat tool which shows where the files and who use the space in reality.

It was the temp folder of the user who runs the VSTS load test agent service. The location is below which is filled by the load test runs.

C:\Users\<user who runs the VSTS load test service>\AppData\Local\Temp\

It seems many people faced the same drive and folder size mismatch in different scenarios. Some experiences are here and here.

Tuesday, May 7, 2019

Node-PlantUML package to automate generation of mind map diagrams

Recently I was doing some experiments with PlantUML. PlantUML is awesome. Write code and get diagrams. It is especially great tool for engineers like me who are not that good at art. One of the main trend now a days is to automate anything and obviously we can automate diagram generation from puml file. The technology to do is obviously NodeJS.

Package to generate images from .puml files

As normal in Node world, NodeJS has a package to convert puml files into images and much more. Below is the link to the NPN package.
https://www.npmjs.com/package/node-plantuml

From here, this post assumes the reader has knowledge about NodeJS and its NPM package ecosystem.

A simple problem

If there is no problem this post is not needed. The node-plantuml package generated the diagrams for most for the puml files. But not for the mind map pumls. ie which are starting with @startmindmap.

@startmindmap
* root
** 1
**_ 3
@endmindmap

Root cause

The node-plantuml uses plantuml.jar file to bundle with it is not the latest. That jar file don't have the capability to understand @startmindmap. So it fails.

Solution

node-platuml package to include the latest plantuml.jar file. As a responsible developer, who make use of other's open source work, I should give them a PR which I will be doing soon.

Workarounds

Set the path of plantuml.jar

As any other developer, the developers of this package also left option for configuring the path to jar file. They selected the environment variable mechanism to set the path. The name of environment variable is PLANTUML_HOME. If the environment variable is not there, it will take jar file from vendor folder. Below line is from the node-plant package source code.

The code to set the environment variable to a different .jar file is as follows. If we obtain the latest plantuml.jar file, we can place it somewhere and point to the same.

process.env.PLANTUML_HOME = "node_modules/node-plantuml/vendor/plantuml_new.jar";

If there are any troubles setting the path, try the below approach.

Replace old file with new

Get the latest plantuml.jar file from VS code extension called PlantUML. The location of the platuml.jar file is below.

%userprofile%\.vscode\extensions\jebbs.plantuml-2.10.9

Put the file into the node-plantuml modules folder. Location below.

..\node_modules\node-plantuml\vendor

Tuesday, April 30, 2019

Architecture of www.JoymonOnline.in via PlantUML

The previous post was about setting up the environment for coded C4 architecture diagram using PlantUML. This post is about how the same can be leveraged for the architecture of www.JoymonOnline.in web site.

It is just a simple personal portfolio site whose architecture has already done in C4 model. The conversion is simple and its available along with the source itself in GitHub.

Below is a screenshot how it render in VS Code.

Its difficult to unless opened in a different window.

Happy diagramming...

Tuesday, April 23, 2019

Setting up PlantUML for coding C4 architecture diargams

Background

Earlier there was a post in this blog related to documenting architecture using C4 Architecture model. The architecture of www.joymononline.in is documented in the C4 way. At least, the context diagram. The problem what was tried to solve in that post was how to make code inline with architecture.

It is easy to document architecture for a static portfolio site or a simple CRUD operations site with login feature. But difficult in Enterprise systems especially, if the rate of change is so rapidly. Now a days, if a software is changing its happening at high speed with the advent of DevOps culture and practices such as continuous integration, delivery and monitoring etc...

Problem

When we follow any documentation model as a technical person, we may face below problems
  • Versioning with application code.
    • What if a feature branch changes the architecture or component interaction or alter dependencies
    • Comparing what changed from last version?
  • The time taken to beautify the diagrams. Skills depends on person to person and difficult to get it uniform when organization grows.

Potential solution

One way we could apply is coding the architecture. Meaning, store the architecture diagrams in textual representation and store along with code.Generate diagrams out of it. It is a simple idea similar to using markdown for documents. Its human and machine readable.

Let's see one way to document C4 architecture model using textual language. First introducing of some terms and later see how they are smartly glued to get coded C4 architecture diagrams.

PlantUML

This is a text based UML modeling. This has specs and free to use. It has also Java based rendering mechanism which uses another free software called GraphViz to visualize the diagrams.

GraphViz

This is a visualization tool for creating diagrams. Its open source. This is needed by PlantUML to render charts.

VS Code & plantuml extension

This is the developer's favorite editor. As usual, there is an extensions to easily write and preview the diagrams. The name of the extension is 'plantuml'. We can either install via extension editor or by command. Thanks to the author Jebbs for the extension and making open source.

How to setup VS Code for PlantUML is already mentioned in below link. Since we are living in 21st century, the Japanese language in the post can be converted automatically by the browser to English:)

https://ameblo.jp/sijukara-tama/entry-12445811317.html

C4-PlantUML github repo

The magic is here. Below repo has the C4 customization files for PlantUML to understand the C4 language.
https://github.com/RicardoNiepel/C4-PlantUML

Big thanks to Ricardo for his work and especially for open sourcing the same. The repo has enough details about the capabilities and sample to get started.

Another interesting thing he did is the availability of Azure customization. These files help us to diagram using Azure symbols than boring boxes.
https://github.com/RicardoNiepel/Azure-PlantUML

Troubleshooting

Though some of us get environment working in the first attempt itself, I am trying to do a video (my first tech video) on how to setup the environment for doing C4 architecture of www.joymononline.in via PlantUML notations and the tools mentioned above

If we go step by step there will not be any issues. First install Java. That will make sure the PATH variable is set properly. Then install GraphViz. Even there is no issue installing in different order as those are not dependent. Now install the VSCode and 'plantuml' plugin. the plugin contains the plantuml.jar file. Finally download the customization from C4-PlantUML repo and open in VS Code. Check the preview by Alt+D shortcut.

Once we have the environment setup its easy as typing the diagram and previewing it in same window. Commit the file once ready. Better integrate with build pipeline.

Conclusion

The mix of specs & tools is little complex but easy to setup and use. Though there is no support for the tools we as developers can fix the issues and add features in those tools and give back to the community

Tuesday, April 16, 2019

ASP.Net Diagnostic page to dump request and environment for troubleshooting

It is often seen that we need to dump all the request variables such as headers and all to do troubleshooting. Many things can be dumped using IIS logs itself either by enabling those or by adding extended data fields. Refer below link for details on extended logging.
https://docs.microsoft.com/en-us/iis/extensions/advanced-logging-module/advanced-logging-for-iis-custom-logging

But in some scenarios that is not enough. For example to ensure that the user name / alias is correctly obtained in ASP.Net code. In those scenarios, it is better to dump using custom code. Below is a code snippet which uses ASP.Net template techniques to dump http request and environment variables such as user name etc...

It doesn't need any code behind or pre-compilation. Just save this as file with .aspx extension say dump.aspx.


Running the dump.aspx

Place into the folder and browse that file as
http://<FQDN>/<app name if applicable>/dump.aspx

eg: https://localhost/MyApp/dump.aspx

It is advised just put this file when we debug and not to add as part of application. But if permitted  check in this file into source control so that the troubleshooting will be much easier.

This is tested mainly in .Net Full Framework. Yet to check with .Net Core.

References

The problem has already been faced by many and there are already enough links where people shared the solution. Since every solution is unique putting one more along with some below.

https://code.msdn.microsoft.com/ASPNET-Diagnostic-page-to-9a029c20
https://pedrosneglectedtechblog.blogspot.com/2010/02/quick-and-easy-http-header-dump-aspnet.html
https://blogs.msdn.microsoft.com/friis/2013/01/08/asp-net-authentication-test-page/

Tuesday, April 9, 2019

Visual Studio Online / Azure DevOps load testing - On-premise agent service is not starting

This is a simple troubleshooting post related to VisualStudio Online or Azure DevOps load testing.
The load testing needs agent programs to be installed on multiple machines to generate load. We can use agents provided by Microsoft as well if our application is straight forward and accessible from Microsoft hosted agents.

If we are in Enterprise or in restricted environments, we may have application hosted internally and only accessible via domain joined machines or via other constraints. Then we need to run the agent program on premise.

Problem

The agent program is a windows services which we can see in services.msc console. Sometimes the agent service gets stopped and below error will show up when we try to restart.

---------------------------
Services
---------------------------
The VSTSLoadAgentService service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.
---------------------------
OK 
---------------------------

Solution

Since this Azure DevOps load testing tool is deprecated now and ending its life next year around this time, lets not go into the details why its not working. Lets see a hack.

As standard Microsoft solution which is as famous as machine restart, lets uninstall and install the agent program again and it will work.

Since the installation is by running below PowerShell scripts, it doesn't seems polluting registry and all.

Uninstalling agent

Uninstall command needs the agent name. If the name if unknown, first we need to get agents list. Example is as follows.

.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName https://<organization>.visualstudio.com -PATToken <PATToken> -AgentGroupName <group name> -GetAgents

to uninstall an agent follow the below command.

.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName https://<organization>.visualstudio.com -PATToken <PATToken> -DeleteAgent -AgentGroupName <group name> -AgentName <agent name>

Now install the agent again.

.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName https://<organization>.visualstudio.com -PATToken <PATToken> -ConfigureAgent -AgentGroupName <group name>

The ManageVSTSCloudLoadAgent.ps1 file can be downloaded from this location. The commands above has some parameters enclosed in '<' & '>' as placeholders. We need to use actual values there.