Friday, May 26, 2017

Some Linux performance tweaks

If a linux machine needs to be scrutinized for performance from a networking perspective,  here are some 'sysctl' variables worth looking at.

1. rmem_max:
2. wmem_max
3. tcp_wmem
4. tcp_rmem
5. somaxconn
6. netdev_max_backlog
7. tcp_max_syn_backlog
8. tcp_fin_timeout
9. tcp_slow_start_after_idle
10. ip_local_port_range
11. tcp_tw_reuse
12. tcp_tw_recycle
13. file_max


And then, there is /etc/security/limits.conf

References:

RH Enterprise Performance Tuning Guide

And miles to go before I sleep

I had to quit the startup recently, thanks to the work I was automating which effectively made my position redundant. Not that it was much fun anyways after the crux of the automation. Thereafter, pursued ideas of visitor management and smart home automation. The drawdown for both ideas seems like:
1. It doesn't solve any pain point bad enough to open wallets.
2. Both ideas have a low entry barrier.

So back to the job cart, until I found something worth hitting the road again.
Attended a a slew of interviews, I realize a few things:
1. Most interviews are online on hackerrank and I seem to run out of time.
2. I can't code as fast as I used to.
3. No matter how many languages you know, never forget C.

This means I need to more practice and I intend to get as proficient as I can be.

 

Tuesday, May 2, 2017

The genesis of a visitor tracking solution using open source



In 2014, the need for such a software was felt when I became in charge of apartment security as a committee volunteer and was riddled with 2-3 security complaints of petty theft on a daily basis, that remained unsolved and caused angst amongst residents.

Although our guards at the time got less than 10,000 INR /month(156USD/mo) and were nowhere like the G4S like guards, I wondered if it was they lacked the ability, the motivation or maybe the means and the data or were involved themselves. There was a loud call from residents at that time to fire and replace this agency with another security agency by forking more money and it seemed to drown any semblance of reason.

Putting ourselves in the shoes of the security guard, we understood that the guards needed more info to solve the thefts. The apartment saw about 600-700 visitors on any given weekend and its a herculean task to do the guards job with his current set of tools, aka the barely legible register and CCTVs.

The existing SaaS based solution in the market at that time introduced an unacceptable delay in the impatient visitor queues and were also unaffordable in mock usability tests for the scale of our complex.

 After installation, with just basic features in place, to my surprise, after we solved the first couple of incidents quickly and easily. Aided by this tracking solution and CCTVs, which most importantly helped us map faces to names and phone numbers and lookup their frequency and timing of visits, major security incidents trailed down to barely double digit through the course of the year. I reckon word-of-mouth through domestic staff and vendors about the new security measures played its part as well in acting as a deterrent.

The first case we solved was of a malicious Water Treatment Plant technician who irreparably damaged a motor to implicate another. The second case, a case of a voyeur peeping tom, who had become a regular nuisance and apartments having exhaust windows near the staircase shuttered as a precaution. Records and timings of incidents were tallied, including the first few reports that were initially deemed to be hearsay, faces were matched and the offender turned out to be an newspaper boy, who was identified and handed over to the authorities. When these cases were solved quickly, word spread. Thereafter, all of a sudden, thefts of shoes and shoeboxes trailed off, and battery thefts from bikes became folklore.

 After sharing the data with other members, we also realized that visitor patterns could be used to determine how many vacant units we had when we had to procure Waste segregation units. It was also used to determine the noisy flat hosting a wee hours midnight party over which neighbors were losing sleep over the weekday. Long story short, it ensures sound sleep and peace of mind for the management and the residents alike. For a repeat visitor, it ensures a quick hassle free checkin as we already know where they've been before and the same
info is not requested again, leading to an express check-in.

 

Oh yes, and we still have the same security agency working here today, and residents have blissfully forgotten why they were so hostile to having them deployed earlier.

As to the skeptics who doubted the learning capabilities of security staff, we learnt that if a young security guard can do Facebook and Whatsapp on his mobile, he for sure can do this.

2017 June:
Its now been up and running for 3 years now, having processed 4L+ visits from close to 45000 unique visitors.

Some Linux performance tweaks

If a linux machine needs to be scrutinized for performance from a networking perspective,  here are some 'sysctl' variables worth l...