Posts
Accessing Cloudwatch logs via AWS CLI
AWS Cloudwatch cloudwatch allows to take a peek into your aws applications, their logs and other metrices. Apart from the centralized logging (kibana,loggly) where we limit retention duration (cost factor), cloudwatch provides a way to do pay-per-volume query operations.
AWS CLI installation on mac
configuration aws configure Setting up AWS keys
Although cloudwatch comes with a nice GUI, we can leverage CLI to automate and ease up some tasks. Here is a use case for filtering logs and downloading them for further analysis.
read morePosts
Get the most out of your command line experience
up arrow key takes you to a list of recently used commands
history command lists out the history of your commands (size as configured)
you can search in your history by using (ctr-R), helpful if you know some keyword
You can tag your commands with comments for ease with history search
eg : some esoteric command #fixes-all (You can reverse search using fixes-all)
all your commands in history are numbered
read morePosts
Parallelism, Concurrency And Golang
Concurrecy Vs Parallelism (Go-lang Example) This is the general understanding of concurrency vs parallelism.
Parallelism: Having multiple threads do similar task which are independent of each other in terms of data and resource that they require to do so. Eg: Google crawler can spawn thousands of threads and each thread can do it’s task independently.
Concurrency: Concurrency comes into picture when you have shared data, shared resource among the threads. In a transactional system this means you have to synchronize the critical section of the code using some techniques like Locks, semaphores, etc.
read morePosts
Idea of 'closure' in functional programming
Closure The inner function has access to variables which were in the enclosing scope even after that ’ennclosing scope’ execution is over. (Inner function gets a copy) This is my attempt to understand why is this such an important concept in functional programming, why is it named so and so on… Functions are first class citizens In functional paradigm of programming functions are considered as ‘first class citizens’. This means functions can be
read morePosts
Monoliths Vs Microservices
Microservice is not the silver bullet Software Industry is heavily trend-driven. People love going behind the trendy hypes
microservices are cool containers are cool noSQL is cool this new language/framework is cool what makes a good use case for microservice? functionality has very clear demarcation/boundary (the most important.. don’t try to force split an already domain complex module) functionality needs independent scaling functionality needs lot of re-use (many components need it) functionality demands language agnosticity (rapid iterations, deployment) what should you ensure?
read morePosts
Debugging Slow Queries In Backend
What are the things that should be on your checklist when you are facing a situation where your db queries are taking a lot of time?
Cross check simple things such as if you would require pagination. If your filters are none (or too broad) even with optimized query plan/indexing query can take some time.
Take the slow query, view the execution plan and cross check if you would require indexing, if your query is set to run with the indices (eg: is the query properly making use of functional indices?
read morePosts
Why Some ISPs block TCP 22?
Why Some ISPs block TCP 22?
Recently I got to know that some ISP indeed block any outbound traffic for port 22 (tcp) which is a standard port for ssh connections.
(I came to know about this as I was being unable to log into one of the compute instances from my terminal via gcloud in gcp. I prefer terminal logins instead of browser as it’s simply 100 times easier to work with.
read morePosts
Safely Indexing an Array (C to Java)
Arrays
Arrays are contiguous locations of memory set aside during compilation. (memory allocated is virtual address which is later mapped to actual memory address during run-time)
In the most simple form you need a base address and you can read starting from there. (there’s a limit how far you can go even with languages like C)
Simple Integer Array in C:
int arr[] = {1,2}; for (int i=0;i<10;i++){ printf("%d\n",arr[i]); } C doesn’t have a way to have a check on how far to go.
read morePosts
First PR (rather lame) that got merged
This was primarily for the inconvenience I had faced a few days prior java-storage API returns null for object with space in name
Fixing this issue required a bump in version
Upgraded version required an additional dependency which wasn’t documented. I added it.
(This is a rather lame contribution but I hope it gives me an impetus for trying and exploring more)
read morePosts
ENTRYPOINT Vs CMD in Docker
CMD Vs Entrypoint is a bit confusing at the beginning. When should you use CMD and when should you use ENTRYPOINT while building your docker images?
CMD
This is the command that runs when you start a container.
Eg:
cmd-docker
FROM ubuntu CMD [ "echo" , "this is running from CMD which runs when the container starts" ] Building an image:
docker build -t cmd-docker -f cmdvsentrypoint.yaml .
Default docker run:
read more