Skip to main content

Posts

Showing posts from 2016

PyCache - A simple, yet extensible in memory Python caching library/framework

https://github.com/Abhisar/PyCache A Small library/extensible framework that aims to solve the problem of needing a cache while coding small/medium scale python projects without depending on 3rd party cache systems. PyCache This library aims to solve the problem of generic object(Python) caching without depending on 3rd party caching systems like Memcached or Redis for cases where it isn't really required. Library has been written in such a way it can be extensible by following standards through implementations of Python Abstract Base Classes. pycache folder  : It has all the base classes. One that ensures ensures all cache schemes follow a similar implemntation i.e https://github.com/Abhisar/PyCache/blob/master/pycache/BaseCache.py  and Other one is for the Objects to be cacheable they have to subclass this Base class  https://github.com/Abhisar/PyCache/blob/master/pycache/BaseCacheable.py CacheImplenations folder : This folder contains different caching schemes. Cur

DNS - Domain Name Subsytem (A very High Level Dive)

Many of us would already know what a DNS is but for starters, it is the thing that converts the URL to IP address when we to hit a URL. The part I want to focus is how underrated and much unknown is this system to people apart from the fact I mentioned above.  In fact, I am lucky enough to get an in-depth look at how crucial DNS system and how it forms the backbone of highly scalable distributed system where you agree to an SLA for some milliseconds or might less at InMobi. So this post is more focused towards starters and not so fancy because that's how it should be understood. Why is DNS important ? Imagine you have to deploy a service on the internet and you agree to your consumers for 100 or 200 ms latency  but an improper DNS setup or DNS query can add 200ms or up of latency and added to that your geolocation.Hence it becomes important to tune your DNS server to your need.Let's get into details. This is a very high-level view of things and people should explor

How HTTPS works- SSL/TLS

Difference between spin locks and semaphores--Some Notes

up vote down vote accepted Both manage a limited resource. I'll first describe difference between binary semaphore (mutex) and spin lock. Spin locks  perform a busy wait - i.e. it keeps running loop(In turn heavy CPU usage example is in Reactor usage of AsyncTaskExecutors): while (try_acquire_resource ()); ... release(); It performs very lightweight locking/unlocking but if the locking thread will be preempted by other which will try to access the same resouce the second one will simply try to acquitre resource untill it run out of it CPU quanta. On the other hand  mutex  behave more like: if (!try_lock()) { add_to_waiting_queue (); wait(); } ... process *p = get_next_process_from_waiting_queue (); p->wakeUp (); Hence if the thread will try to acquire blocked resource it will be suspended till it will be avaible for it. Locking/unlocking is much more heavy but the waiting is 'free' and 'fair'. Semaphore  is a lock that is allowed to