A personal project, which if I now look back, is a competitive programming problem!

Repo: https://github.com/nnanto/gravity

Gravity is like a memory allocator i.e, given some data, we’ll organize the data (or free them) in our memory. Also, as we walk through the project, we’ll derive questions that are similar to those in competitive programming

Source: https://hacks.mozilla.org/2017/06/a-crash-course-in-memory-management/

Yes, we are the person with the cap but we would do much less in this project. But is there a scenario where this allocator will be useful? There might be. In languages with garbage-collector, storing a lot of data in memory causes long pauses during…


Toy app running multiple NATS servers in a TailScale Network

The End Product

The aim of this toy app is to experiment with Tailscale (more on tailscale below). When we run the application (a binary actually), it will :

  1. Ask for person to login via Gmail/Microsoft/Tailscale
  2. Once logged in, will start a server
  3. Repeating Step 1 & 2 in multiple systems (located anywhere) with same login account will result in all those servers communicating securely with each other i.e, these servers will form a cluster.

Diagrammatically, after running it in three machines, it’d look something like this:

Fig 1: Three NAT servers (machines) are connected to each other (peer-to-peer) using Tailscale. [Arrows are bi-directional but are drawn unidirectional for aesthetics]

Tech Stack: Go, TailScale, NATS

Now…


Introduces a few backend concepts and jargons to Front-end developers

Disclaimer:
The main aim of this post is just to introduce bits and pieces of backend and is no way a guide to backend development. To add to this, I’m NO EXPERT so read with caution!

Atlantic & Pacific oceans don’t mix

Just like how the entire ocean is just one body of water but there’s an invisible wall between the Atlantic & Pacific ocean, I consider Frontend and Backend development to be like that. They are the same… wait… are they?

Key for the readers: FED => Front-End Developer | BED => Back-End Developer MD…


Lets cut to the chase (we are talking about optimization anyway ;) The plan was to implement the following functions:

  1. Alloc: Given a size, allocates memory and returns a reference (offset)
  2. Free: Given the reference (offset), frees the associated memory

We’ll skip how these functions were implemented and we’ll stick to knowing what it does, which is the same as malloc, new, free, etc... So, I had an initial version of my code (alloc & free) in GoLang and ran some benchmark to check its performance.

Allocating multiple objects of random size with totaling to Total Allocation Size in bytes and 1061 ns/op implies nanoseconds took per operation.

Even though we are allocating and freeing chunks of objects that sum more than…


A simple method to maintain and evolve code with schema contracts.

Before we start, for those super-humans who can convert code to blog/documentation here’s the link to the Github Repo.

@skimmable ( The Problem )

  1. If you’ve ever consumed from an API or a Pub/Sub service then you’d have spent your time digging through the documentation of the writer’s schema (data model).
  2. If you think reading the documentation is time consuming then have you ever tried updating an API version to get one feature and ended up changing many models?

Even though Open API specifications help save time, we still have to create objects in…

Naveen Anto

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store