Posts

Favorite AWS Athena queries for ALB Logs stored in S3

Image
What is the most visited page by the client and total traffic on my website? SELECT sum(received_bytes) as total_received, sum(sent_bytes) as total_sent, client_ip, count(client_ip) as client_requests, request_url FROM alb_logs GROUP BY client_ip, request_url ORDER BY total_sent desc; How long does it take to process requests on average? SELECT sum(request_processing_time) as request_pt, sum(target_processing_time) as target_pt, sum (response_processing_time) respone_pt, sum(request_processing_time + target_processing_time + response_processing_time) as total_pt, count(request_processing_time) as total_requests, sum(request_processing_time + target_processing_time + response_processing_time) / count(request_processing_time) as avg_pt, request_url, target_ip FROM alb_logs WHERE target_ip <> '' GROUP BY request_url, target_ip HAVING COUNT (request_processing_time) > 4 ORDER BY avg_pt desc; Which requests does the site doesn’t process? It’s usually some person

Activity Tracking for Web Applications

Image
Dealing with user activity in web applications is almost always an afterthought. To that, we should also understand that this is not something new and has been happening for quite a long time by major platforms and websites out there.  I am no judge to say if it is a good practice or not, but as an engineer, I will try to note down the recent development in this space over the years. And, moreover, if you are tasked to do something similar for your new app, how you can go about doing it. Let's talk about the basics Our primary goal is to reliable track user's activity without affecting the application performance. Now, what is categorized as user activity is something we will address in a future blog, but regardless of the granularity of the data what is our concern at the moment is how we collect metrics data from a technical perspective. Overarchingly, we have two kinds of data being passed around the server and browser. Namely, analytical data and transactional data. Our fir

Cache me if you can 🏃! A Guide to keep your cache fresh as a daisy with stale-while-revalidate

Image
Today, we are going to talk about an additional tool to help you maintain a fine balance between instancy and freshness when delivering data to your web applications. RFC5861 states two independent Cache-Control extensions that allow for the cache to respond to a request with the most up-to-date response held. 1. The stale-if-error HTTP Cache-Control extension allows a cache to return a stale response when an error such as Internal Server Error is encountered, rather than returning a hard error. This improves availability. 2. The stale-while-revalidate HTTP Cache-Control extension allows a cache to immediately return a stale response while it revalidates it in the background, thereby hiding latency (both in the network and on the server) from clients In this blog, we will be talking more about the stale-while-revalidate HTTP header. The basic idea of this header is to reduce the latency of serving cached content by your web browser to your application and have a refresh mechanism via w

MCD Model of Leadership

Image
The MCD model of leadership consists of three main stages: Managing Coaching  Delegating Almost 54% of business leaders do not have the knowledge of these 3 stages involved in Leadership and the rest of them even though familiar with the concepts don't really have any idea of when to adhere to which stage mentioned above. Courtesy - Inc Magazine Let me lay down the steps that are involved in each of the following action categories: Managing (Zoom-in) Close Supervision Control Direct Instruct One-way communication Testing Feedback Coaching (Zoom-mid) Feedforwarding Involve Develop Encourage Listen Support Facilitate Awareness Delegating (Zoom-out) Accountability Responsibility Support Praise The MCD Model helps a business leader tackle the following problems in day to day business: Losing a member of the team Disengaging with the team members and ideas Loss of productivity Loss of opportunities

Domain Name System: The important parts

Image
What is a domain name? According to RFC 1034, which lays out the original DNS specification, the domain name of a node is a list of labels on the path from the node to the root of the tree.  Okay, let's try to phrase it in a more comprehensible way. A domain name describes a node on the tree by tracing the node all the way back to the root. Every label along that path becomes a part of the domain name. The takeaway here is that we can describe a node by its domain name. For the sake of brevity, in this article, a domain name is also referred to as the "domain" from now onwards.  Now the root of the tree is represented by a dot. For example, iamshouvikmitra.blogspot.com is represented as iamshouvikmitra.blogspot.com.   [.]   |_ [com]         |_ [blogspot]                    |_ [iamshouvikmitra] Therefore, the domain for "com" is "com.", the domain from "blogspot" is "blogspot.com.", and finally the domain for node "iamshouvikmit

Announcement : I will be writing code full time!

Image
Ti's the season, I have been recently looking for an Internship, and lucky enough I was able to be selected for a few roles at some different startups in what is called the Silicon City of India. Even though I haven't decided which one to join, but still I am pretty sure, I will stick to web development in the near future. Since from now on I will be paid to write code for the web, thus, finally I will be able to focus on learning JavaScript and the Web in much more depth and speed up the process of learning new things so that I could keep up this rapidly changing Industry. Frankly speaking, as I have noticed it myself, it's difficult for any students to know it all, and the vastness of JavaScript would overwhelm anyone trying it for the first time. As a defence mechanism, one thing all JavaScript developers intend to do to keep up the updates is to sign up for newsletters and read blogs. So, after a few days to drolling over a few, I have gathered enough sources and fe

Easy Speed Optimization for Web Developers

Image
A majority of the web is still accessed via slow 2G networks, so when it comes to web speed optimizations, developers should take the responsibility to make their web apps as optimized as it could possibly be. Most of you might think that increasing speed performance trades of with user experience. Well, frankly speaking, most of the time it does, but it doesn't need to be that way! In this article, I will be sharing top 3-speed optimization strategies which will help you bring a smile to your users face even on slow network speed. 1. Images Images should be the appropriate format, compression, and size; and loaded only when necessary The images commonly contribute to a majority portion of your website. Thus, it is very important to serve your static images in an optimized and performant way. To be successful with images, it is necessary that you automate and systemize them. Checklist : Appropriate format Appropriate compression Appropriate for display size and dens