<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Learnings on Programmer's Insight</title><link>https://blog.ganapathy.xyz/learnings/</link><description>Recent content in Learnings on Programmer's Insight</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 02 Mar 2025 00:40:27 -0800</lastBuildDate><atom:link href="https://blog.ganapathy.xyz/learnings/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding Read Your Own Writes Consistency in Distributed Systems</title><link>https://blog.ganapathy.xyz/2025/01/understanding-read-your-own-writes.html</link><pubDate>Sun, 26 Jan 2025 22:04:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2025/01/understanding-read-your-own-writes.html</guid><description>&lt;p&gt;Have you ever updated your social media status only to refresh the page and find your update missing? Or modified a product listing that seemingly disappeared into the void? These frustrating user experiences often stem from a crucial concept in distributed systems: Read Your Own Writes (RYW) consistency.&lt;/p&gt;&#10;&lt;h2&gt;Why RYW Consistency Matters&lt;/h2&gt;&#10;&lt;p&gt;In my recent DZone article, I dive deep into the world of Read Your Own Writes consistency - a critical yet often overlooked aspect of distributed system design. While technical requirements often focus on scalability and performance, RYW consistency directly impacts how users perceive and interact with our systems.&lt;/p&gt;</description></item><item><title>Striking the Balance: How Companies Can Personalize Without Compromising Privacy</title><link>https://blog.ganapathy.xyz/2024/12/striking-balance-how-companies-can.html</link><pubDate>Fri, 13 Dec 2024 23:03:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2024/12/striking-balance-how-companies-can.html</guid><description>&lt;p&gt;I recently published an article on &lt;a href="https://www.dataversity.net/delivering-personalized-recommendations-without-sacrificing-user-privacy/" rel="noopener noreferrer"&gt;DataVersity&lt;/a&gt; exploring one of today's most pressing digital challenges: how to deliver personalized experiences while protecting user privacy. As someone deeply interested in both user experience and data protection, I found this topic particularly fascinating to research and write about.&lt;/p&gt;&#10;&lt;h2&gt;Why This Matters Now&lt;/h2&gt;&#10;&lt;p&gt;We're all familiar with those eerily accurate Netflix recommendations or Spotify playlists that seem to read our minds. But have you ever wondered how companies can provide these personalized experiences while keeping your data safe? In my DataVersity article, I dive deep into this question, exploring real-world examples from tech giants like Apple, Google, and Netflix.&lt;/p&gt;</description></item><item><title>The Hidden Backbone of the Internet: Infrastructure, Innovations, and the Future of Connectivity</title><link>https://blog.ganapathy.xyz/2024/11/the-hidden-backbone-of-internet.html</link><pubDate>Mon, 04 Nov 2024 00:19:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2024/11/the-hidden-backbone-of-internet.html</guid><description>&lt;p&gt;&amp;nbsp;Internet infrastructure may seem invisible, but it's a complex web of data centers, fiber-optic cables, IXPs, and cutting-edge technologies. Data centers are the backbone, powering cloud storage and digital communications, while fiber-optic networks act as high-speed highways for data. Internet Exchange Points (IXPs) allow data to be transferred more efficiently between providers, keeping speeds high and reducing latency.&lt;/p&gt;&lt;p&gt;Adding to this are &lt;strong&gt;Content Delivery Networks (CDNs)&lt;/strong&gt; like Cloudflare and Akamai, which cache data closer to users, reducing load and improving response times for data-heavy activities like streaming.&lt;/p&gt;</description></item><item><title>Rate Limiting in System Design: Protecting Your APIs and Servers</title><link>https://blog.ganapathy.xyz/2023/08/rate-limiting-in-system-design.html</link><pubDate>Tue, 15 Aug 2023 21:30:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2023/08/rate-limiting-in-system-design.html</guid><description>&lt;p&gt;&amp;nbsp;With the rise of large-scale applications and APIs, handling excessive traffic is a major challenge. &lt;strong&gt;Rate limiting&lt;/strong&gt; is a crucial technique used to protect systems from abuse, prevent &lt;strong&gt;DDoS attacks&lt;/strong&gt;, and ensure fair resource allocation. In this blog, we’ll explore &lt;strong&gt;rate limiting strategies&lt;/strong&gt;, their implementations, and real-world use cases.&lt;/p&gt;&lt;hr&gt;&lt;h2&gt;&lt;strong&gt;1. What is Rate Limiting?&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Rate limiting controls the number of requests a client can send to a server within a specified time frame. It helps:&lt;br&gt;✅ &lt;strong&gt;Prevent server overload&lt;/strong&gt; – Protects backend services from excessive traffic.&lt;br&gt;✅ &lt;strong&gt;Enhance security&lt;/strong&gt; – Mitigates DDoS attacks and bot abuse.&lt;br&gt;✅ &lt;strong&gt;Ensure fair usage&lt;/strong&gt; – Prevents a single user from consuming all available resources.&lt;br&gt;✅ &lt;strong&gt;Optimize performance&lt;/strong&gt; – Ensures smooth operation for all users.&lt;/p&gt;</description></item><item><title>Caching in System Design: Speeding Up Performance</title><link>https://blog.ganapathy.xyz/2023/06/caching-in-system-design-speeding-up.html</link><pubDate>Mon, 12 Jun 2023 00:37:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2023/06/caching-in-system-design-speeding-up.html</guid><description>&lt;p&gt;&amp;nbsp;As applications scale, performance becomes a critical concern. One of the most effective ways to improve &lt;strong&gt;response times&lt;/strong&gt; and &lt;strong&gt;reduce database load&lt;/strong&gt; is by using &lt;strong&gt;caching&lt;/strong&gt;. Whether you're designing a high-traffic web application or a distributed system, caching can significantly enhance speed and scalability.&lt;/p&gt;&lt;hr&gt;&lt;h2&gt;&lt;strong&gt;1. What is Caching?&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Caching is the process of storing frequently accessed data in a &lt;strong&gt;fast, temporary storage layer&lt;/strong&gt; (e.g., RAM) to avoid redundant computations or database queries. Instead of fetching data from a slow backend, caching enables applications to retrieve it almost instantly.&lt;/p&gt;</description></item><item><title>Database Sharding: A Guide to Scaling Your Database</title><link>https://blog.ganapathy.xyz/2023/03/database-sharding-guide-to-scaling-your.html</link><pubDate>Tue, 14 Mar 2023 00:36:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2023/03/database-sharding-guide-to-scaling-your.html</guid><description>&lt;p&gt;&amp;nbsp;As applications grow, handling massive amounts of data becomes a challenge. One of the most effective ways to scale a database is &lt;strong&gt;sharding&lt;/strong&gt;—a technique that partitions large datasets into smaller, more manageable pieces across multiple servers. In this guide, we’ll explore the fundamentals of &lt;strong&gt;database sharding&lt;/strong&gt;, its benefits, challenges, and real-world applications.&lt;/p&gt;&lt;h2&gt;&lt;strong&gt;1. What is Database Sharding?&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Database sharding is a technique where a large database is split into smaller, independent databases called &lt;strong&gt;shards&lt;/strong&gt;. Each shard contains a subset of the total data and can operate independently, reducing the load on a single database instance.&lt;/p&gt;</description></item><item><title>Mastering Load Balancing in System Design</title><link>https://blog.ganapathy.xyz/2023/01/mastering-load-balancing-in-system.html</link><pubDate>Fri, 27 Jan 2023 00:34:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2023/01/mastering-load-balancing-in-system.html</guid><description>&lt;p&gt;&amp;nbsp;In modern system design, ensuring high availability, reliability, and scalability is crucial. One of the key techniques to achieve this is &lt;strong&gt;load balancing&lt;/strong&gt;. Whether you're designing a small-scale web application or a globally distributed system, a well-implemented load balancing strategy can significantly improve performance.&lt;/p&gt;&lt;h2&gt;&lt;strong&gt;1. What is Load Balancing?&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;Load balancing is the process of distributing incoming network traffic across multiple servers to ensure no single server gets overwhelmed. It helps improve response time, maximize resource utilization, and provide redundancy in case of server failures.&lt;/p&gt;</description></item><item><title>System Design Refresher</title><link>https://blog.ganapathy.xyz/2022/05/system-design-refresher.html</link><pubDate>Wed, 18 May 2022 00:33:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2022/05/system-design-refresher.html</guid><description>&lt;p&gt;In today’s tech-driven world, designing scalable and efficient systems is crucial for building robust applications. Whether you are a software engineer, an architect, or an aspiring system designer, understanding the principles of system design can set you apart in the industry.&lt;/p&gt;&lt;h2&gt;&lt;strong&gt;1. What is System Design?&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;System design is the process of defining the architecture, components, modules, interfaces, and data flows of a system. It involves making decisions on how different parts of an application interact to ensure scalability, reliability, and maintainability.&lt;/p&gt;</description></item><item><title>Secure Coding Practices in Go</title><link>https://blog.ganapathy.xyz/2020/12/secure-coding-practices-in-go.html</link><pubDate>Mon, 21 Dec 2020 20:30:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2020/12/secure-coding-practices-in-go.html</guid><description>&lt;h1&gt;&amp;nbsp;Introduction&lt;/h1&gt;&#10;&lt;p&gt;As Go continues to gain popularity for building web services, APIs, and cloud-native applications, the security implications of Go code are becoming increasingly important. While Go provides many built-in features that help developers write more secure code—such as strong typing, memory safety, and garbage collection—there are still numerous security pitfalls that can lead to vulnerabilities.&lt;/p&gt;&#10;&lt;p&gt;Over the past several years, I've conducted security reviews for numerous Go applications and microservices, uncovering common patterns that lead to security issues. In this article, I'll share practical secure coding practices for Go developers, covering common vulnerabilities, security-focused code patterns, authentication and authorization best practices, and approaches for managing sensitive data.&lt;/p&gt;</description></item><item><title>Containerization Best Practices for Go Applications</title><link>https://blog.ganapathy.xyz/2019/02/containerization-best-practices-for-go.html</link><pubDate>Thu, 21 Feb 2019 16:00:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2019/02/containerization-best-practices-for-go.html</guid><description>&lt;h1&gt;Introduction&lt;/h1&gt;&#10;&lt;p&gt;Containerization has revolutionized how we build, ship, and run software. By packaging applications and their dependencies into standardized, isolated units, containers provide consistency across different environments, improve resource utilization, and enable more flexible deployment options. Docker, the most popular containerization platform, has become an essential tool in modern software development and operations.&lt;/p&gt;&#10;&lt;p&gt;Go's compiled nature, small runtime footprint, and minimal dependencies make it particularly well-suited for containerization. Over the past year, I've containerized numerous Go applications for production deployment, learning valuable lessons about optimizing container builds, managing configurations, handling secrets, and orchestrating containers at scale.&lt;/p&gt;</description></item><item><title>Performance Optimization Strategies for Go Web Services</title><link>https://blog.ganapathy.xyz/2017/01/performance-optimization-strategies-for.html</link><pubDate>Thu, 19 Jan 2017 14:00:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2017/01/performance-optimization-strategies-for.html</guid><description>&lt;h1&gt;Introduction&lt;/h1&gt;&#10;&lt;p&gt;Performance is a critical aspect of modern web services. In an era where users expect lightning-fast responses and services must handle high volumes of traffic efficiently, optimization becomes not just a nice-to-have but a necessity. While Go already provides excellent performance characteristics out of the box, there's always room for improvement as applications grow in complexity and scale.&lt;/p&gt;&#10;&lt;p&gt;After deploying several Go-based microservices into production over the past year, I've collected numerous insights and techniques for optimizing performance. In this article, I'll share practical strategies for profiling, monitoring, and optimizing Go web services across four key areas: application code, memory management, database interactions, and HTTP connection handling.&lt;/p&gt;</description></item><item><title>Advanced Error Handling Techniques in Go Applications</title><link>https://blog.ganapathy.xyz/2016/04/advanced-error-handling-techniques-in.html</link><pubDate>Thu, 28 Apr 2016 23:14:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2016/04/advanced-error-handling-techniques-in.html</guid><description>&lt;h1&gt;Introduction&lt;/h1&gt;&#10;&lt;p&gt;Error handling is a critical aspect of building robust software systems. How a program handles errors often determines its reliability, maintainability, and user experience. Unlike many modern languages that use exceptions for error handling, Go takes a different approach by making errors first-class values that are explicitly returned and checked.&lt;/p&gt;&#10;&lt;p&gt;While Go's error handling approach is straightforward, developing robust error handling strategies for complex applications requires careful consideration and advanced techniques. Over the past year of building microservices with Go, I've refined my approach to error handling and want to share some patterns and practices that have proven effective in production environments.&lt;/p&gt;</description></item><item><title>Understanding Go's Concurrency Model: Goroutines and Channels</title><link>https://blog.ganapathy.xyz/2015/04/understanding-gos-concurrency-model.html</link><pubDate>Tue, 14 Apr 2015 11:00:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2015/04/understanding-gos-concurrency-model.html</guid><description>&lt;h1&gt;Introduction&lt;/h1&gt;&#10;&lt;p&gt;In today's computing landscape, concurrency has become an essential aspect of programming. With the prevalence of multi-core processors, harnessing their full potential requires writing code that can execute multiple tasks simultaneously. However, traditional concurrency models that rely on threads and locks are notoriously difficult to work with, often leading to race conditions, deadlocks, and other complex issues that can be challenging to debug.&lt;/p&gt;&#10;&lt;p&gt;Go, also known as Golang, takes a different approach to concurrency with its implementation of CSP (Communicating Sequential Processes), a model originally described by Tony Hoare in 1978. Go's concurrency primitives—goroutines and channels—provide an elegant and intuitive way to write concurrent code that is both readable and maintainable.&lt;/p&gt;</description></item><item><title>RESTful API Design Principles and Implementation in Go</title><link>https://blog.ganapathy.xyz/2014/09/restful-api-design-principles-and.html</link><pubDate>Sun, 21 Sep 2014 17:00:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2014/09/restful-api-design-principles-and.html</guid><description>&lt;h1&gt;Introduction&lt;/h1&gt;&#10;&lt;p&gt;In today's interconnected world, APIs (Application Programming Interfaces) have become the foundation of modern software architecture. Among the various API design approaches, REST (Representational State Transfer) has emerged as the dominant paradigm for building web services. As Go continues to gain traction in the server-side development space, it presents an excellent option for implementing RESTful APIs due to its simplicity, performance characteristics, and strong standard library.&lt;/p&gt;&#10;&lt;p&gt;In this article, I'll explore the core principles of RESTful API design and demonstrate how to implement these principles using Go. Whether you're new to API development or looking to improve your existing practices, this guide will provide practical insights to help you build more robust, maintainable, and user-friendly APIs.&lt;/p&gt;</description></item><item><title>Getting Started with Go: A Systems Programming Language for the Modern Era</title><link>https://blog.ganapathy.xyz/2014/09/test1.html</link><pubDate>Sat, 15 Mar 2014 22:34:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2014/09/test1.html</guid><description>&lt;h2&gt;Introduction&lt;/h2&gt;&#10;&lt;p&gt;The programming landscape is constantly evolving, with new languages emerging to address the limitations of existing ones. In recent years, one language has been gaining significant traction among systems programmers and web developers alike: Go (or Golang). Developed at Google by Robert Griesemer, Rob Pike, and Ken Thompson, Go aims to combine the efficiency and safety of statically typed compiled languages with the simplicity and productivity of dynamic languages.&lt;/p&gt;</description></item><item><title>Performance metrics of Computer Systems - 1</title><link>https://blog.ganapathy.xyz/2013/03/performance-metrics-of-computer-systems.html</link><pubDate>Wed, 20 Mar 2013 21:53:00 -0700</pubDate><guid>https://blog.ganapathy.xyz/2013/03/performance-metrics-of-computer-systems.html</guid><description>&lt;div&gt;&#10;When we think about evaluating the performance of a system, some things that comes to our mind are&lt;br&gt;&#10;&lt;br&gt;&#10;a) Configuration and Flow that needs to be bench-marked.&lt;br&gt;&#10;b) Number of instances of node/server (1 or many ).&lt;br&gt;&#10;c) Duration of the task.&lt;br&gt;&#10;d) Tools that are gonna be used for analyzing and preparing report.&lt;br&gt;&#10;e) Existing benchmark report of the system for comparing the new data.&lt;br&gt;&lt;br&gt;Let&#10; me give you my idea on each of the above aspects as well as my views on&#10; performance metrics of a system. Specifically let me discuss about "&lt;i&gt;arriving&amp;nbsp; at benchmarks when we release the Version 1 of the software&lt;/i&gt;" in this blog. &lt;br&gt;&#10;&lt;br&gt;&#10;consider a simple coin toss :)&amp;nbsp; Yeah its about probability and queuing :D &lt;br&gt;&#10;How are we going to measure the performance of this toss? &lt;br&gt;&#10;a) May be height travelled by the coin ?&lt;br&gt;&#10;b) Number of flips it makes? etc etc.&lt;br&gt;&#10;&lt;br&gt;&#10;We use &lt;i&gt;"laws of physics"&lt;/i&gt; as a tool to measure the performance metrics of the coin.&lt;br&gt;&#10;&lt;br&gt;&#10;Now&#10; consider a system where messages are received, parsed and given to &#10;various components and sent back. This kind of system is called &lt;i&gt;Open system&lt;/i&gt;.&lt;br&gt;&#10;&lt;br&gt;&#10;There is one more type of system called &lt;i&gt;Closed System&lt;/i&gt;.&#10; Interpret it to a CI machine where CI-coordinators submit jobs which &#10;in-turn is executed on a set of machines ( servers ) and returns back to&#10; idle state.&lt;br&gt;&#10;&lt;br&gt;&#10;Our software (Version 1) can be open or &#10;closed. As we don't have any previous benchmarks for this software, we &#10;have to arrive at a theoretical bench-mark so that we are able to &#10;ascertain the practical measurements.&lt;br&gt;&#10;&lt;br&gt;&#10;So how do we arrive at theoretical benchmarks? &lt;br&gt;&#10;Using Queuing models :-). Yeah its all maths buddy :D&lt;br&gt;&#10;&lt;br&gt;&#10;For those who have taken a Queuing course, these things should not be new. Others please continue reading.&lt;br&gt;&#10;&lt;br&gt;&#10;As we are used to event-driven programming, lets continue our thoughts using this.&lt;br&gt;&#10;&lt;br&gt;&#10;What is event-driven programming? &lt;br&gt;&#10;Some&#10; events happen and based on the event we execute some tasks ( code ). &#10;After this may be the server goes to wait state to handle next set of &#10;events.&lt;br&gt;&#10;&lt;br&gt;&#10;So lets define 4 set of events.&lt;br&gt;&#10;a) Customers / Messages arrive randomly (which we call Poisson arrivals)&lt;br&gt;&#10;b) Customers / Message wait in queue for getting processed. &lt;br&gt;&#10;c) They get processed. ( called exponential service times)&lt;br&gt;&#10;d) They leave the system ( our system memory allocs are put back to pool. )&lt;br&gt;&#10;&lt;br&gt;&#10;Of-course&#10; there are certain systems where messages arrive at fixed time slots &#10;like burst ( Systems like ALOHA / Slotted ALOHA uses something like &#10;this. Other case may be where attacker is trying to send a burst message&#10; causing buffer overflows in network elements) or what not.&lt;br&gt;&#10;&lt;br&gt;&#10;So having defined these events we can categorize our system ( software ) as M/M/N/K system.&lt;br&gt;&#10;First&#10; M denotes the arrival rate of messages into our system. Second M &#10;denotes the rate at which it is processed. N denotes the number of &#10;servers handling our messages and K denotes the system capacity.&lt;br&gt;&#10;&lt;br&gt;&#10;Why do we have two M's ?&lt;br&gt;&#10;Aren't the messages going to be served in the order they arrive?&lt;br&gt;&#10;&lt;br&gt;&#10;No.&#10; Most systems have some thing called classes similar to IntServ/DiffServ&#10; model where customers paying more are grouped into higher classes and &#10;have better experience while those pay low have lower experience &#10;comparatively.&lt;br&gt;&#10;&lt;br&gt;&#10;Also consider the case where server is bombarded with lots of requests it can't handle. What can server do now ?&lt;br&gt;&#10;&lt;br&gt;&#10;It can delay the person entering the system through some protocols like Stateless Cookie protocol&lt;br&gt;&#10;i.e&#10; if some one sends INVITE message in case of SIP protocol or SYN message&#10; in case of TCP the server handling it can send a reply asking him to &#10;solve a hardest puzzle/ calculating a hash which would take sufficient &#10;amount of time for the sender to compute and reply. In the mean time &#10;server clears the messages in its queue and is ready to accept new &#10;connections.&lt;br&gt;&#10;&lt;br&gt;&#10;So we are deliberately delaying the &#10;customer entering the system. This happens with IRCTC [ Indian Railway &#10;Reservation Systems Servers :) ] &lt;br&gt;&#10;&lt;br&gt;&#10;So coming back to our M/M/N/K model, this model has a set of predefined formulas through which&lt;br&gt;&#10;one&#10; can arrive at various metrics of system like throughput, delay, waiting&#10; time of customer(message), time spent by the message in the system etc.&lt;br&gt;&#10;&lt;br&gt;&#10;Using&#10; these values along with the system parameters one can arrive at the &#10;theoretical bench-mark of a system and then use it to compare with &#10;practical data of our version1 software.&lt;br&gt;&#10;&amp;nbsp; &lt;br&gt;&#10;Let us conclude it for now. Other factors would be posted gradually.&lt;br&gt;&#10;Hope you got something out of this post.&lt;br&gt;&#10;Please post comments/feedback (if any).&lt;/div&gt;</description></item><item><title>Traceroute: How It Works and Overcoming Firewall Limitations</title><link>https://blog.ganapathy.xyz/2013/03/interesting-read-trace-route-over-tcp.html</link><pubDate>Sat, 09 Mar 2013 23:25:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2013/03/interesting-read-trace-route-over-tcp.html</guid><description>&lt;div&gt;&lt;h1&gt;Understanding the Basics&lt;/h1&gt;&#10;&lt;p&gt;When we execute a traceroute command, our machine sends out 3 UDP packets with a TTL (Time-to-Live) of 1. When those packets reach the next hop router, it will decrease the TTL to 0 and thus reject the packet. It will send an ICMP Time-to-Live Exceeded (Type 11), TTL equal 0 during transit (Code 0) back to our machine - with a source address of itself, therefore we now know the address of the first router.&lt;/p&gt;&#10;&lt;p&gt;Next our machine will send 3 UDP packets with a TTL of 2, thus the first router that we already know passes the packets on to the next router after reducing the TTL by 1 to 1. The next router decreases the TTL to 0, thus rejecting the packet and sending the same ICMP Time-to-Live Exceeded with its address as the source back to our machine. Thus we now know two paths.&lt;/p&gt;&#10;&lt;p&gt;This process keeps going until we reach the destination. Since we are sending UDP packets with the destination address of the host we are concerned with, once it gets to the destination the UDP packet is wanting to connect to the port that we have sent as the destination port. Since it is an uncommon port, it will most likely be rejected with an ICMP Destination Unreachable (Type 3), Port Unreachable (Code 3). This ICMP message is sent back to our machine, which will understand this as being the last hop, therefore traceroute will exit.&lt;/p&gt;&#10;&lt;h2&gt;The Firewall Problem&lt;/h2&gt;&#10;&lt;p&gt;The regular traceroute usually uses either ICMP or UDP protocols. Unfortunately, firewalls and routers often block the ICMP protocol completely or disallow the ICMP echo requests (ping requests), and/or block various UDP ports.&lt;/p&gt;&#10;&lt;p&gt;When we execute traceroute using ICMP or UDP using commands:&lt;/p&gt;&lt;pre&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;code&gt;traceroute -I www.microsoft.com (ICMP)&#10;traceroute -U www.microsoft.com (UDP)&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;&#10;&lt;p&gt;After some couple of message exchanges, we often end up getting &lt;code&gt;* * *&lt;/code&gt; as the firewall blocks our message.&lt;/p&gt;&#10;&lt;h2&gt;The TCP Solution&lt;/h2&gt;&#10;&lt;p&gt;So how do we get the actual address of the destination host? The answer: using traceroute over TCP.&lt;/p&gt;&#10;&lt;p&gt;To our surprise, executing:&lt;/p&gt;&lt;pre&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;code&gt;traceroute -T -p 80 www.microsoft.com&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;&#10;&lt;p&gt;returns the exact IP address!&lt;/p&gt;&#10;&lt;p&gt;Of course, there are lots of traceroute implementations, and if your system doesn't have the one as stated above, please check &lt;a href="http://michael.toren.net/code/tcptraceroute/" rel="noopener noreferrer"&gt;http://michael.toren.net/code/tcptraceroute/&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2&gt;Why TCP Works Better&lt;/h2&gt;&#10;&lt;p&gt;TCP traceroute works better in these situations because many firewalls are configured to allow TCP traffic on common ports like 80 (HTTP) and 443 (HTTPS), as blocking these would prevent normal web browsing. By using TCP on these permitted ports, we can often bypass the restrictions that would block traditional ICMP or UDP traceroute attempts.&lt;/p&gt;&#10;&lt;p&gt;This technique is particularly useful when troubleshooting connectivity issues to web servers or other services that primarily communicate over TCP.&lt;/p&gt;&#10;&lt;h2&gt;Practical Applications&lt;/h2&gt;&#10;&lt;p&gt;This knowledge can be invaluable when:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Diagnosing network connectivity issues&lt;/li&gt;&#10;&lt;li&gt;Identifying where packets are being dropped in a network path&lt;/li&gt;&#10;&lt;li&gt;Mapping network topologies behind firewalls&lt;/li&gt;&#10;&lt;li&gt;Performing security assessments&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Next time you're faced with a traceroute that's showing stars instead of hops, remember to try the TCP variant - it might just reveal the full path you're looking for.&lt;/p&gt;&lt;/div&gt;</description></item><item><title>Software Diversity as a Security Measure: Can Unique Executables Prevent Attacks?</title><link>https://blog.ganapathy.xyz/2013/02/system-level-protection.html</link><pubDate>Sat, 23 Feb 2013 10:11:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2013/02/system-level-protection.html</guid><description>&lt;p&gt;We're constantly hearing news about cyberattacks on major companies like Facebook, LinkedIn, and Twitter. One common vulnerability often cited is issues with the Java plugin that allow attackers to penetrate systems. While Oracle regularly releases patches, I've been wondering: are these just temporary fixes, or do we need more fundamental approaches to software security?&lt;/p&gt;&#10;&lt;p&gt;Last month, I had the opportunity to attend a fascinating colloquium by Dr. Michael Franz from UC Irvine, held at UT Dallas. His talk, titled "Software Immunity via Large Scale Diversification," presented a novel approach to cybersecurity that got me thinking about the future of software protection.&lt;/p&gt;</description></item><item><title>Elegant Software Design: Principles for Maintainable Applications</title><link>https://blog.ganapathy.xyz/2013/02/my-favourite-lines.html</link><pubDate>Fri, 22 Feb 2013 19:47:00 -0800</pubDate><guid>https://blog.ganapathy.xyz/2013/02/my-favourite-lines.html</guid><description>&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;p&gt;In my journey as a software engineer, I've discovered that writing code that merely functions is the easy part. The real challenge lies in crafting code that remains maintainable and adaptable as systems evolve. Today, I'd like to share some design principles that have proven invaluable when building robust applications.&lt;/p&gt;&#10;&lt;h2&gt;The Foundation of Good Design&lt;/h2&gt;&#10;&lt;p&gt;At its essence, good software design is about managing complexity. As systems grow, complexity naturally increases. Without intentional design decisions, this complexity becomes overwhelming, leading to bugs, development friction, and technical debt.&lt;/p&gt;&#10;&lt;p&gt;As Ralph Johnson once said, "Before software can be reusable, it first has to be usable." This simple statement captures the importance of thoughtful design in creating sustainable software systems.&lt;/p&gt;&#10;&lt;h2&gt;SOLID Principles&lt;/h2&gt;&#10;&lt;p&gt;The SOLID principles provide an excellent framework for creating maintainable code. Let's explore each one:&lt;/p&gt;&#10;&lt;h3&gt;Single Responsibility Principle&lt;/h3&gt;&#10;&lt;p&gt;A class or module should have only one reason to change. This principle encourages us to design components that are focused on a single concern, making them easier to understand, test, and maintain.&lt;/p&gt;&#10;&lt;p&gt;When I first started programming, I often created large, monolithic classes that handled multiple concerns - validation, database operations, email notifications, and logging all in one place. Eventually, I learned that separating these responsibilities into distinct components made my code significantly more maintainable.&lt;/p&gt;&#10;&lt;p&gt;For example, instead of a massive UserManager class that handles everything, we might have a UserValidator, UserRepository, NotificationService, and ActivityLogger, each with a clear, focused responsibility.&lt;/p&gt;&#10;&lt;h3&gt;Open/Closed Principle&lt;/h3&gt;&#10;&lt;p&gt;Software entities should be open for extension but closed for modification. This means we should be able to add new functionality without changing existing code.&lt;/p&gt;&#10;&lt;p&gt;This principle has saved me countless hours of debugging. By designing interfaces that can be extended with new implementations, I can add features without risking regression bugs in existing functionality.&lt;/p&gt;&#10;&lt;p&gt;Consider payment processing - if we design our system properly, adding support for a new payment method (like cryptocurrency) shouldn't require modifying our existing credit card or PayPal processing code.&lt;/p&gt;&#10;&lt;h3&gt;Liskov Substitution Principle&lt;/h3&gt;&#10;&lt;p&gt;Subtypes should be substitutable for their base types without altering the correctness of the program. This principle ensures that inheritance hierarchies are designed properly.&lt;/p&gt;&#10;&lt;p&gt;I've seen many inheritance hierarchies that violate this principle, creating subtle bugs. For instance, a Square class that inherits from Rectangle might seem logical, but could break code that expects to set width and height independently.&lt;/p&gt;&#10;&lt;h3&gt;Interface Segregation Principle&lt;/h3&gt;&#10;&lt;p&gt;Clients should not be forced to depend on interfaces they don't use. It's better to have many small, specific interfaces than one large, general-purpose interface.&lt;/p&gt;&#10;&lt;p&gt;This principle has helped me create more flexible and decoupled systems. By defining focused interfaces, components only need to implement what they actually use, reducing unnecessary dependencies.&lt;/p&gt;&#10;&lt;p&gt;For example, rather than having a single FileHandler interface with methods for reading, writing, compressing, and encrypting, we might have separate Reader, Writer, Compressor, and Encryptor interfaces.&lt;/p&gt;&#10;&lt;h3&gt;Dependency Inversion Principle&lt;/h3&gt;&#10;&lt;p&gt;High-level modules should not depend on low-level modules. Both should depend on abstractions. Additionally, abstractions should not depend on details; details should depend on abstractions.&lt;/p&gt;&#10;&lt;p&gt;This principle has been transformative for my approach to software design. By depending on abstractions rather than concrete implementations, I can easily swap out components without changing the core business logic.&lt;/p&gt;&#10;&lt;p&gt;For instance, a UserService might depend on a DataStore interface rather than directly on MongoDB or PostgreSQL implementations, making it easy to change the underlying storage mechanism.&lt;/p&gt;&#10;&lt;h2&gt;Practical Design Patterns&lt;/h2&gt;&#10;&lt;p&gt;Beyond SOLID principles, several design patterns have proven particularly useful in my projects:&lt;/p&gt;&#10;&lt;h3&gt;Factory Pattern&lt;/h3&gt;&#10;&lt;p&gt;The Factory pattern provides a way to create objects without specifying the exact class of object that will be created. This pattern helps decouple object creation from the code that uses the objects.&lt;/p&gt;&#10;&lt;p&gt;I've found this pattern especially useful when the exact type of object needed isn't known until runtime, or when object creation involves complex logic.&lt;/p&gt;&#10;&lt;h3&gt;Strategy Pattern&lt;/h3&gt;&#10;&lt;p&gt;The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. This pattern allows the algorithm to vary independently from clients that use it.&lt;/p&gt;&#10;&lt;p&gt;I've used this pattern extensively for implementing different business rules, sorting algorithms, or pricing strategies that can be selected dynamically based on context.&lt;/p&gt;&#10;&lt;h3&gt;Decorator Pattern&lt;/h3&gt;&#10;&lt;p&gt;The Decorator pattern allows behavior to be added to individual objects, either statically or dynamically, without affecting the behavior of other objects from the same class.&lt;/p&gt;&#10;&lt;p&gt;This pattern has helped me add cross-cutting concerns like logging, caching, or access control to existing functionality without modifying the core components.&lt;/p&gt;&#10;&lt;h3&gt;Observer Pattern&lt;/h3&gt;&#10;&lt;p&gt;The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.&lt;/p&gt;&#10;&lt;p&gt;This pattern has been invaluable for building event-driven systems and user interfaces, where changes in one component need to be reflected in others.&lt;/p&gt;&#10;&lt;h2&gt;Design Principles in Practice&lt;/h2&gt;&#10;&lt;p&gt;While these principles and patterns provide valuable guidelines, applying them effectively requires judgment and context. Here are some practical insights I've gained:&lt;/p&gt;&#10;&lt;h3&gt;Balance is Key&lt;/h3&gt;&#10;&lt;p&gt;Overengineering is just as problematic as underengineering. I've learned to strike a balance between applying design principles and keeping solutions simple.&lt;/p&gt;&#10;&lt;p&gt;Early in my career, I fell into the trap of applying patterns everywhere, creating unnecessary complexity. Now I recognize that sometimes a straightforward approach is best, especially for simpler problems.&lt;/p&gt;&#10;&lt;h3&gt;Evolve Your Design&lt;/h3&gt;&#10;&lt;p&gt;Perfect design rarely happens upfront. Instead, I've found that good design emerges through continuous refactoring and adaptation as requirements become clearer.&lt;/p&gt;&#10;&lt;p&gt;I now practice incremental design, starting with simpler solutions and gradually introducing patterns and abstractions as complexity increases.&lt;/p&gt;&#10;&lt;h3&gt;Consider the Team&lt;/h3&gt;&#10;&lt;p&gt;Design decisions should account for the team's expertise and familiarity with different patterns. The most elegant design is worthless if the team struggles to understand and maintain it.&lt;/p&gt;&#10;&lt;p&gt;I've learned to collaborate with team members when making design decisions, ensuring everyone understands and buys into the approach.&lt;/p&gt;&#10;&lt;h3&gt;Test-Driven Design&lt;/h3&gt;&#10;&lt;p&gt;Writing tests first often leads to better design decisions. When I write tests before implementing features, I'm forced to consider how components will be used, leading to more intuitive interfaces.&lt;/p&gt;&#10;&lt;p&gt;This approach has helped me create more modular, loosely coupled designs that are easier to test and maintain.&lt;/p&gt;&#10;&lt;h2&gt;Conclusion&lt;/h2&gt;&#10;&lt;p&gt;Good software design isn't about following rules rigidly—it's about understanding the principles behind them and applying them judiciously to your specific context. The principles and patterns I've outlined here have served me well in my own projects, helping me create code that's not only functional but also adaptable to change.&lt;/p&gt;&#10;&lt;p&gt;As your applications evolve, you'll find that time invested in thoughtful design pays dividends in reduced maintenance costs and increased development velocity.&lt;/p&gt;&#10;&lt;p&gt;Remember that the best code is not just correct—it's clear, maintainable, and a joy to work with. Happy coding!&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;&lt;em&gt;What design principles have you found most valuable in your projects? I'd love to hear your thoughts in the comments below.&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description></item></channel></rss>