Retry when 429 and 5XX

Retry usage guidance

Consider the following guidelines when using retries in your MicroServices

  • If you are using the REST API for inter-(micro)-service communication, retry the operation if the result code is 429 (Too Many Requests) or an error in the 5xx range. Do not retry for any other errors.
  • For 429 errors, only retry after the time indicated in the Retry-After header.
  • For 5xx errors, use exponential back-off, with the first retry at least 5 seconds(?) after the response.
  • Do not retry on errors other than 429 and 5xx.

Continuous integration,

Continuous integration

Continuous integration (CI) is the practice of automating the integration of code changes from multiple contributors into a single software project. It’s a primary DevOps best practice, allowing developers to frequently merge code changes into a central repository where builds and tests then run. Automated tools are used to assert the new code’s correctness before integration.

A source code version control system is the crux of the CI process. The version control system is also supplemented with other checks like automated code quality tests, syntax style review tools, and more.  


Types of Git workflow

Types of git workflow

  • Centralised Workflow: Everyone works/pushes only on one branch (main/master) from central repository on server
  • Feature Branch Workflow: Everyone do their feature development on dedicated feature branch rather than on main/master branch. Team collaborates through pull requests and merge reviews.
  • Gitflow Workflow:
    Dedicated channels for feature development, release, hotfixes.
  • Forking Workflow

All other workflow had a single server side repository. In this one, every developer has their own dedicated server side repository.

Human Readable Binary Search

In this post, I used

  • Introduce explaining boolean variables
  • Given attention to variable naming

Please review the below code or visit https://gist.github.com/way2datta/7d32ee72289f7f5c5ea2d4068139f48d
and let me know your thoughts?

public class IntArray
{
public static int BinarySearch(int[] items, int searchTerm)
{
return SearchRecursively(items, searchTerm, 0, items.Length 1);
}
private static int SearchRecursively(int[] items, int searchTerm, int lowerIndex, int upperIndex)
{
var scannedAllItems = lowerIndex > upperIndex;
if (scannedAllItems) return 1;
var middleIndex = (lowerIndex + upperIndex) / 2;
var middleItem = items[middleIndex];
var isItemPresentAtMiddleIndex = items[middleIndex] == searchTerm;
if (isItemPresentAtMiddleIndex) return middleIndex;
var searchItemInLowerHalf = middleItem.CompareTo(searchTerm) > 0;
if (searchItemInLowerHalf) return SearchRecursively(items, searchTerm, lowerIndex, middleIndex 1);
var searchItemInUpperHalf = middleItem.CompareTo(searchTerm) < 0;
if (searchItemInUpperHalf) return SearchRecursively(items, searchTerm, middleIndex + 1, upperIndex);
return 1;
}
}
view raw BinarySearch.cs hosted with ❤ by GitHub

Witness Running Many Programs At Once from Windows Command Prompt

In this blog post, you will witness how multi-core CPU executes different processes and do context switching.

We will use the following program, this program merely takes input from the user and prints input string after some time periodically.

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
internal class Program
{
[DllImport("Kernel32.dll"), SuppressUnmanagedCodeSecurity]
public static extern int GetCurrentProcessorNumber();
private static void Main()
{
var currentProcess = Process.GetCurrentProcess();
Console.WriteLine($"Please enter any string for process {currentProcess.Id} which is executed by {GetCurrentProcessorNumber()}: ");
var readline = Console.ReadLine();
var i = 0;
while (i++ < 12)
{
Console.WriteLine($"For process {currentProcess.Id} which is executed by {GetCurrentProcessorNumber()}, you have entered: {readline}");
Thread.Sleep(1000);
}
}
}
OSPlayground,cs

I presume after compiling the above file, we get the output file: ‘OSPlayground.exe’.

Now open a command prompt and navigate to the path that contains the above binary. Run the following command and witness the magic.

Command to use: start /b OSPlayground && OSPlayground

Output:

The command prompt will ask you to enter the string a couple of times since we executed the program twice.
I had inputted EARTH! for the first process from the command prompt and MARS! for another one.

The above program is executed on a multicore processor.