Categories
fiction writing

Dabba

Trrrrrriiiinnnnnnnggggg… the school bell rang, signalling in the lunch break. Raghu and Anirudh slipped out of the classroom before the class teacher allowed the children to leave. Unlike other children who would sit in or around the classroom and eat their lunch, these two would visit a different spot in the school each day.

Their classroom was in one of the older buildings of the school. It housed the 4th to 6th standard classes. Both of them were waiting to be promoted to the 7th standard – when they would move to the new building. Everything was so new and clean, the smell of fresh paint, new furniture and the classrooms even had cabinets for the children.

“Let’s go to the playground near the church,” Raghu said.

St. Johns’ English Medium School was one of the older schools in the locality. Three school buildings and two grounds around a small church formed the school.

Anirudh was Raghu’s best friend and they were always together during school. When one of them did not come to school, the other felt out of place. Their lunch time together was special because they could talk, crack jokes and make fun of others. The lunch break was forty-five minutes long, and the boys usually took an extra five minutes to get back to class.

They found a shaded spot on the ledge on the wall near the playground where there weren’t any other children. Though it was lunch time, there were kids who were still on the playground. Some playing catch-catch with a tennis ball, some cricket and some just walking around in small groups without purpose.

Raghu had his dabba with him. He wondered what his Amma had packed for him. It usually was a few idlis, or dosas, and sometimes a rice mix. He loved to eat rice and pickle, but she didn’t send it frequently enough. He opened the small steel box and saw four idlis.

“Oh no, Not idlis again”, he said aloud. He wondered what Anirudh had got for lunch today. He often got special lunch; sometimes fried rice, parathas, chole bature etc.

“Where’s your dabba?”, Raghu asked seeing that Anirudh was empty-handed.

“Mom could not send one today. Would you share yours with me?”

“No, we should not share food and should get our own dabbas”, Raghu said while turning to look towards the playground.

During lunch, while Raghu ate his idlis, Anirudh tried not to look at his dabba. He instead looked at a small group of children who were playing cricket on the far side of the ground. The boys then talked about the half-yearly school fair that was to be held in the coming weekend. It was something that all the kids looked forward to since they could come to the school with their parents and play games and eat from the many food stalls that would be setup. The school bell rang and they realized their lunch time was over.

As they walked back towards their classroom, Raghu wondered if he did the right thing by not sharing his food with Anirudh. Anirudh got his dabba most of the times, but he wouldn’t once or twice a month.

“Yes, it’s the right thing to do. That’s the only way he would get his dabba everyday”, he thought to himself and put his arm around Anirudh’s shoulder.

Categories
tech time

Serving Time on the Internet

One of the top things taken for granted is Time on the internet. Think about it. We have millions, billions, gazillions of devices – servers in data centers running the Googles and the Facebooks, laptops etc. needing to have the right time.

Why? So that financial transactions have accurate timestamps, or that you can see the right time when you want to. The needed accuracy depends on the nature of the application – be in a few sec, few ms or sub-ms. How does all of this work seamlessly in the internet?

Almost all of the internet synchronizes using the Network Time Protocol (NTP). NTP is a protocol or a method for computer clocks to synchronize over a network – including the internet. NTP is one of the oldest protocols active on the internet. Implementations of NTP started coming into use well before 1985 when RFC 958 was published. NTPv4 was published in 2010 with RFC 7822 bringing in NTPv4 field extensions as recently as 2016.

About NTP

In the NTP protocol, there is a client and a server. The client is the one seeking time, the server serves it.

How does it work? In simple terms, the client sends a request to the server asking for the time. The client believes that the server has a more accurate time. The request contains the client side timestamp. The server receives the request, and responds back with the timestamp on the server side. The client factors in the delay for packet transit and finally computes the offset (difference between the servers’ time and its own). This allows the client to optionally adjust its own clock. The client polls the server periodically – but not too frequently so that the server can cater to a large number of clients if it would like to do so.

OK, I admit the above is an oversimplification; but the intent of this write-up is not to explain the protocol.

When we talk about time synchronization on the internet, we have many servers providing time using NTP to hundreds or thousands of clients on a regular basis. These are run on a voluntary basis by government bodies, corporations or organizations and individuals.

ntp.org is the home of the Network Time Protocol project. The NTP Pool project is one which enables and provides the framework of NTP pools.

What is a NTP pool? The NTP pool project creates a pools of servers and groups them in geographical zones (with country as the lowest granularity). As an example, if a client from Japan requests for time from the NTP Japan pool, the client is assigned one of the servers who are participating in the Japan pool. This allows clients to be connected with servers that are in their proximity thereby allowing for faster synchronization.

State of affairs

Number of NTP servers across zones
Number of servers across zones

As can be seen in the image above, certain areas like Europe have good participation in the pool whereas Asia, South America have extremely poor participation.

If you have a server on the internet with a static IP address, the best way to help is to join the pool. You can join the pool by following the instructions here.

NTP servers

Running an NTP server on the internet does not require a larger amount of maintenance. Some things to sort out before you embark as a timekeeper on the internet.

  • Selecting the server software – ntpd, ntpsec, chrony etc. There are slight differences between each of these though the overall concept and configuration is the same.
  • Ensuring your server has a static address – one that is fixed for the long term (think years!)
  • Ensuring you have the right connectivity (bandwidth & a stable connection)
  • In terms of hardware resources – both CPU and memory, the ask of an NTP server is minimal. However if you are handling a tens of thousands of clients, CPU starts to become a consideration
  • Which hardware – there are different opinions about virtual machines vs dedicated hardware – virtual machines can very much hold their own in the NTP Pool being extremely stable. You just need to choose a suitable provider

Mental note: At some point, I will put together a brief comparision of ntpd, ntpsec and chrony in their default configuration.

How many sources is good enough?

The NTP Pool project suggests to setup 4-7 servers to synchronize time with. I love this quote.

A man with a watch knows what time it is. A man with two watches is never sure

Unknown, taken from here

Once you configure the 4-7 servers to synchronize with, your NTP server will start polling them to maintain its own time.

After joining the pool, the NTP Pool project starts monitoring your servers time via NTP. Your server is assigned a score based on the offset and anything more than 100ms is not acceptable. An unacceptable score starts degrading your score and eventually you are kicked out of the pool available for clients. If your server recovers, your score gradually improves and once over 10, you are again added into the pool available for clients. You can monitor your server as in the below image.

Offset monitoring in ntppool.org
Offset monitoring in ntppool.org

The burden of serving time

Don’t underestimate the network traffic requirements of running a NTP server. If you are not careful, your bandwidth can easily run into many TB per month. Depending on your bandwidth usage plan for the server, this might result in huge additional costs that you did not factor in. One good set of articles available to check this in detail are here, here and here.

The NTP Pool project allows you to manage your servers and tune the bandwidth you want for your server. This is not an exact setting since the NTP Pool project only connects clients to you (via DNS) but clients can continue to be attached to you from a few hours to days to even years.

Individual clients do not pose a bigger challenge as long as they are using standard NTP client software; but additional challenges come with misbehaving clients who will poll too frequently or pool continuously – even many many times per second. There are ways to address these – using rate limitation rules in your NTP server software or implementing a firewall.

Finally, once you have your server configured and setup exactly how you like, a picture like this will bring a big smile on your face.

Monitoring NTP packets per second on the server
Monitoring NTP packets per second on the server

Conclusion

Running a NTP server is a great project to contribute to the Internet infrastructure as well as to learn about running a production system on the internet. There are a number of considerations before embarking on such a project, but it could be lead towards a very satisfying experience.

Categories
writing

Unlocked

April 2022, the world has been in lockdown for two years.

A rumble of thunder awoke Varun from his sleep. He checked the clock by the bed; it was 6 AM. Sitting up on the bedside, he stretched his arms upwards. The pain in his elbows had subsided – it was like this in the mornings and got worse during the day. He stepped out to the balcony – he loved the view he had from the 15th floor. This morning though, it was raining, and he couldn’t see much.

After brushing his teeth, he looked at the softboard in the kitchen where he had his housework schedule mapped out. Today was a Friday – the following items were listed

Change curtains (last Fri)

Laundry

Friday party!

Today though was different – today the lockdown was to be lifted. It was difficult to imagine that more than two years had passed since it had started. Varun had taken an off from work today – he thought he needed the day to be able to digest such an event. He had been prepared that the lockdown would be extended the previous evening or by mid-night. After all, it had happened before – twelve times in all.  He spent almost fifteen minutes checking his phone for news on the topic. Nothing indicated otherwise. It was two weeks in a row when the number of new cases had reduced to single digits; and finally, the lockdown was to be lifted: today.

After years of thinking of what to do after the lockdown – his mind was now blank. He had had so many ideas – go out for a run, go for a movie, eat at his favorite Chinese restaurant, hit the pub – but he was now unsure. It was now almost four months since he had stepped out of his apartment. Finally, he made up his mind – he would go to the neighborhood park. He had a cup of coffee and put on his shoes.

He found an umbrella and picked up the keys to the apartment. He hesitated a moment – donned his mask and stepped out.

Categories
diary

Randomness: The subconscious impacts of COVID-19

I wonder about the subconscious impacts of the COVID-19 outbreak. There are a few things that make me cringe.

Almost 80% of the people around my locality wear masks when outside. They pull the mask down when they feel like it. And again, when they want to talk to someone. The mask is there for a reason. To protect yourself – and to protect others. Use it.

During my walks in the evening, I notice people who walk right in the center of the walkway. Some of them will wear masks. Why do you want to throw social distancing in the gutter? Walk on the side: people can walk in both directions. Lanes are good – not just for cars.

This has also affected me while watching TV. If there is a scene of a gathering at home or a party, a shot of a beach – it makes me cringe. It takes me a moment to realize, recall the virus and remind myself that I’m watching TV.

We hear phrases like “the new normal”, “live with the virus”. We’ve started versioning the lockdown – currently on 4.0. Will it reached the number 12 that I wrote about in a fictional piece many weeks ago?

Categories
poetry

Lines #1 – Rocking shore

Boat rocking, stormy sea, water splashing everywhere

Holes appear, water leaking here and there

There is no way out

Far ahead, shore’s seen, hang on, hang on

There is no way out

Above lines are also published in The Writing Gym
Categories
cooking

My first bake

I tried my hand at the no-knead bread recipe. The highly recommended one is the NYT recipe.

As a personal touch, I added some herbs and cheese to the dough while folding it.

It turned out great. I don’t have pictures of the cut unfortunately! That is for the next time.

No knead bread - the dough, the intermediate and the final look

Categories
writing

To write or not to write?

I have attempted to write before. Mostly in private; short-lived private blogs, journals, tech notes. But never took it seriously enough.

Duirng the COVID-19 lockdown, I took up a writing course. I never wanted to be a writer – but I took the course to explore a new dimension, something to keep the mind busy: learning.

What will I write about? My experiments with writing, food, tech and more.

No limits.