Load test your API with Vegeta

Load test your API with Vegeta Vegeta is a open source HTTP load testing tool. Today I’ll demonstrate how quickly and easily we can load test our API endpoint using it in three parts: Get Vegeta Setup a target file Generate reports 1. Get Vegeta Vegeta binaries are available on GitHub Releases . For Windows, all we need to do is to get the Windows executable and unzip it for example under C:\vegeta . The vegeta.exe is the executable we will be using. To make sure it works as expected, we can display the usage guide by execute vegeta.exe without any arguments. > vegeta.exe Usage: vegeta [global flags] <command> [command flags] global flags: -cpus int Number of CPUs to use (default 4) -profile string Enable profiling of [cpu, heap] -version Print version and exit attack command: -body string Requests body file -cert string ... The main concept of Vegeta are the targets . A target represents an endpoint which will be load

Create React App with Mobx in Typescript

Create React App with Mobx in Typescript I have been using state management frameworks for the past few years, mainly with Angular and NGRX . Today we will see how we can get started with Create-React-App using Mobx as a state management system. Bootstrap a fresh application Create components Create an observable state / store Create observers components 1. Bootstrap a fresh application Start by installing the latest version of NPM then use npx to setup a fresh project. npx create-react-app my-app --typescript Then navigate to /my-app and run npm start . This will start the application in a development server with a live reload. The command run by npm start is defined under package.json scripts > start and runs react-scripts start . cd my-app npm start The application should now build and run properly and any changes done on the application should be reflected on the browser. We now have all the necessary tool to start writing code in React. 2. Create component

Setup HTTPS with Nginx on Azure Ubuntu VM

Setup HTTPS with Nginx on Azure Ubuntu VM Today we will see how we can setup HTTPS on using Certbot Nginx configuration on an Azure Ubuntu VM. This post will be composed of three steps: Prepare the VM Install Nginx Install Certbot 1. Prepare the VM We start first by creating an Azure VM on Ubuntu 18.04 with either password or SSH and allowing HTTP , HTTPS , SSH . Once done, we can select a custom DNS for our VM. This makes it easier to SSH but also it will be required for our SSL certificate setup. We set the Assignment as Static then we choose a DNS name label. Here we choose azure-test-vm therefore the VM will be accessible at . We should now be able to SSH into the VM using the command: ssh 2. Install Nginx Next once we are in the VM, we can install Nginx by installing the following: sudo apt-get update sudo apt-get install nginx Once installed, as we already h

Moving from chaining to piping in rxjs 6.x

Moving from chaining to piping in rxjs 6.x Last month I updated all my NPM packages and realised that everything was broken! The reason why was that rxjs decided to move out of extensions on observable in favor of pipable functions from 5.x to 6.x. A major breaking change where majority if not all codebase built using rxjs needs to be changed. Today we will explore the reasoning behind this change. Reasons Example of migration Learnings 1. Reasons The reasons given on the official documentation are: Any library importing the patch operator augmenting the observable prototype would also augment it for all consumers. For example, when a library imports map extension from import 'rxjs/add/operators/map' , it makes map available for all code importing the library itself. This could bring confusion due to the inconsistent way of importing extensions. Some places would not need to important map (those were the library is used) while in other place of the code we would

Entity Framework Core Performance Optimization

Entity Framework Core Performance Optimization Last year I talked about Entity Framework Core . It is a easy and feature rich ORM which makes working with database in a .NET environment typesafe. But even though it makes things easy, there are ambiguous cases which can take us off guard. Today we will see four of this cases and how to deal with them. Client evaluation Iteration Include and ThenInclude NoTracking For the following examples, I will be using SQLite with Entity Framework Core. tl;dr Make sure that the query constructed in c# uses function that can be translated to SQL, Make sure that there isn’t an abnormal amount of queries created and that it does not iter item per item, Make sure to use Include and ThenInclude for object relation to include them after query execution, before query execution it is not needed, Use NoTracking for readonly queries to disable tracking on entity to yield better performance. 1. Client evaluation The following example illust

Create a Navigation loading bar for Angular with PrimeNG

Create a Navigation loading bar for Angular with PrimeNG In Angular, it is common practice to execute commands prior routing a page using guards and resolvers. Guards prevent the routing from occuring until the condition turns to true and resolvers prevent the routing from occuring until the data is returned. Those actions can take time to complete and during the time being, the component will not load leaving the user with an impression of unresponsiveness. Today we will see how we can implement a navigation loading bar for Angular using PrimeNG progress bar component in two parts: Setup an Angular project PrimeNG Progress bar If you are unfamiliar with the Angular router, you can have a look at my previous blog post explaining the feature of the router . 1. Setup an Angular project We start by creating a project and installing PrimeNG. npm install primeng --save npm install primeicons --save Next we a