<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sooraj on Medium]]></title>
        <description><![CDATA[Stories by Sooraj on Medium]]></description>
        <link>https://medium.com/@iSooraj?source=rss-fdffa9582d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jf3Py1yY1FmITr257ys2kQ.png</url>
            <title>Stories by Sooraj on Medium</title>
            <link>https://medium.com/@iSooraj?source=rss-fdffa9582d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:27:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iSooraj/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Sticky Sessions Can Tilt Load Balancers]]></title>
            <link>https://medium.com/@iSooraj/how-sticky-sessions-can-tilt-load-balancers-c5dc8f50099c?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5dc8f50099c</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[sticky-session]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[load-balancing]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 10:33:40 GMT</pubDate>
            <atom:updated>2023-07-16T10:43:24.412Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of Software Engineering, efficiently managing incoming requests across multiple servers is a critical aspect of building robust and high-performing applications. Load balancers serve as indispensable tools to achieve this goal. By evenly distributing incoming traffic among available backend servers, load balancers help prevent server overload and ensure a seamless user experience. This article examines <strong>&quot;sticky sessions&quot;</strong> a load balancing feature that can affect request handling and load distribution. We&#39;ll explore its concept, assess implications on load balancers, and explore alternative strategies for improved system performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*3JSA3rvhg_FO9LAxxW1Olw.jpeg" /><figcaption>Sticky Sessions</figcaption></figure><h4>What Are Sticky Sessions?</h4><p>Sticky sessions, also referred to as session affinity or persistence, is a load balancing technique where a load balancer routes a user’s subsequent requests to the same backend server they initially connected to. This is achieved by storing session information in the form of cookies or other mechanisms. The idea behind sticky sessions is to maintain user state and prevent issues with sessions being lost or disrupted when users interact with a dynamic web application.</p><p><strong>In Layman terms,</strong> Sticky sessions are like having a favourite waiter in a restaurant. When you visit, the manager assigns you a specific waiter. You had a great experience, the next time you come back, they make sure you get the same waiter who already knows your preferences, making your dining experience enjoyable again.</p><p>Load balancers mainly use round-robin algorithms for even traffic distribution, but sticky sessions break this method by directing specific clients to the same server, sacrificing load balancing fairness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kznyUoRgUcw9pCQUaGfbNw.jpeg" /><figcaption>Sticky Sessions vs Round Robin</figcaption></figure><h4>When you might go for a Sticky Sessions approach?</h4><p>In scenarios involving personalized data or services like shopping carts, banking, or customized pagination, also at times it is difficult to manage <a href="https://en.wikipedia.org/wiki/Eventual_consistency">eventual consistency</a> or availability of data to all servers. Sticky sessions help maintain continuity and personalized experiences for users throughout their interactions.</p><p>Modern load balancers like <a href="https://www.nginx.com/">Nginx</a> offer straightforward configuration options for enabling sticky sessions, ensuring seamless user experiences and improved application performance.</p><p>We just need to modify our nginx config file by adding the ip_hash directive in the upstream block to enable sticky sessions based on the client&#39;s IP address.</p><pre>http {<br>    # Define the upstream backend servers<br>    upstream my_backend_servers {<br>        ip_hash; # This enables sticky sessions<br>        server backend_server1_ip:backend_server1_port;<br>        server backend_server2_ip:backend_server2_port;<br>    }<br> # other configuration<br>}</pre><p>There may be different ways to support this feature in different load balancers but… Hey! you get the idea. So lets look at the pros and cons of using Sticky Sessions.</p><h4>Pros</h4><p>Sticky sessions offer seamless user experience, session persistence, improved performance, support for stateful applications, simplified load balancer operations, less data consistency challenges to deal with and aid in troubleshooting by isolating issues to a single server.</p><h4><strong>Cons</strong></h4><p>Sticky sessions can lead to an uneven distribution of traffic across backend servers. If a specific server gets more requests from sticky sessions, it might become overloaded while other servers remain underutilized. This can affect the overall performance and efficiency of the load balancing setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*zfROloQYrEe3i5iku2dAGg.jpeg" /><figcaption>Uneven distribution</figcaption></figure><p>Sticky sessions may not make the most efficient use of server resources. Some backend servers might be idle or have minimal traffic while others are heavily loaded. This inefficient resource allocation can increase operational costs and waste hardware resources. <br>Sticky sessions can complicate server maintenance and failover processes. If a backend server fails, the users associated with that server’s sticky sessions will lose their connection, and their sessions will be interrupted. Implementing failover mechanisms that handle sticky sessions requires careful planning and synchronization between servers.</p><p>So the purpose of load balancer to balance the traffic evenly may at times be uneven with sticky sessions and we may end up overload and destroy the servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1fzus9Ll1fJ3i-9tzWgHaQ.jpeg" /></figure><h4>Alternative</h4><p>There can be multiple ways to avoid using sticky sessions and still provide a seamless user experience. One effective approach is employing distributed cache to manage sessions, allowing any server to handle user requests seamlessly.</p><h4>Conclusion</h4><p>Sticky sessions can offer benefits for specific scenarios, but they can also introduce issues related to load balancing, scalability, and failover. When designing load balancing strategies, it’s crucial to weigh the pros and cons of sticky sessions against alternative approaches. Each application is unique, and the choice of load balancing technique should align with the specific requirements and performance goals. Peace..✌️</p><p>~ Sooraj</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5dc8f50099c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rate limiting ft. Bots using GO]]></title>
            <link>https://medium.com/@iSooraj/rate-limiting-ft-bots-using-go-65fafed08157?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/65fafed08157</guid>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[gỗ]]></category>
            <category><![CDATA[throttling]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Sat, 24 Jun 2023 15:43:33 GMT</pubDate>
            <atom:updated>2023-06-24T15:43:33.207Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you’re cruising down a highway, feeling the wind in your hair and the music blasting, when suddenly you spot those lovely sign boards flashing the speed limit. They’re like your nagging friends, reminding you to slow down because the road ahead is either a mess or simply not equipped to handle your need for speed :P.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*ZRmI1zo3VgCBUEIXJYXKiQ.jpeg" /></figure><p>Well, guess what? Rate limiting works in a similar way! You see, when you have a fancy website or application deployed on the cloud, it attracts users wanting a piece of the action. And just like how your hunger for speed can overwhelm a road, these users can flood your servers with requests. So, to keep things under control, you need to slap some limits on those requests. Think of it as putting up virtual sign boards that say, “Hey you, slow down✋!! Our servers can only handle so much!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*8Jo8drS7UstBp-BhH6f_SQ.jpeg" /></figure><p>Why bother, you ask? Well, my friend, every time your server has to handle an excessive number of requests, it needs extra resources — more servers, more hardware, maybe even some fancy caching mechanisms. And you know what that means? It means you have to pay more. 💸💸</p><p>When it comes to rate limiting, there are multiple stages within our backend application where we can implement it. However, for now, let’s zoom in on restricting requests from clients to our servers. While caching might seem like a straightforward solution, it’s not always applicable, especially when dealing with requests that require live data or login validations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*iQoBh8WMC_nIc0EZNmlGjg.jpeg" /><figcaption>Our Scenario</figcaption></figure><p>Let’s begin by defining bots as logout/no auth users for the purpose of this article. We’ll discuss various techniques and strategies to effectively manage and control their access.</p><p>Lets implement a basic get visits endpoint in GO without rate limiting you can use any language. Lets say the endpoint returns visitor count for a page with a 200 OK status. 🤩</p><pre>package main<br>import (<br> &quot;math/rand&quot;<br> &quot;net/http&quot;<br> &quot;github.com/gin-gonic/gin&quot;<br>)<br><br>func getVisits(context *gin.Context) {<br> // some handler mock, For now we will just return some random<br> context.IndentedJSON(http.StatusOK, rand.Intn(1000))<br>}<br><br>func main() {<br> router := gin.Default()<br> router.GET(&quot;/getVisits&quot;, getVisits)<br> router.Run(&quot;localhost:8080&quot;)<br>}</pre><p>If you never previously worked in GO, That my friend is all you need to run a basic service in GO. May be try now? Meanwhile lets consider this CURL to hit our endpoint.</p><pre>curl --location &#39;http://localhost:8080/getVisits&#39;</pre><p>If we use the simple curl command to send a request, even if we run it sequentially 100 times, it should generally work fine unless our machine is very poor 😐. However, in production, applications experience concurrent requests from multiple users. Therefore, let’s modify the script to enable parallel execution, simulating the scenario where multiple users are interacting with your endpoints adding more load to your servers.</p><pre>#!/bin/bash<br>execute_curl() {<br>    curl --location &#39;http://localhost:8080/getVisits&#39;<br>}<br><br>export -f execute_curl<br><br># Run the curl command 100000 times in parallel<br>seq 100000 | xargs -P 10 -I {} bash -c &#39;execute_curl&#39;</pre><p>This script may cause an overflow or out-of-memory exception on our local machine. If your service is hosted on a cloud platform, it could potentially impact the performance of your service or result in higher bills if not properly limited.</p><p>Lets discuss some techniques for rate limiting.</p><h4>IP-based rate limiting</h4><pre>import (<br> &quot;net/http&quot;<br> &quot;sync&quot;<br> &quot;time&quot;<br><br> &quot;github.com/gin-gonic/gin&quot;<br>)<br><br>const (<br> maxRequests = 2<br> perMinutePeriod = 1 * time.Minute<br>)<br><br>var (<br> ipRequestsCounts = make(map[string]int) //Can use some distributed db<br> mutex = &amp;sync.Mutex{}<br>)<br><br>func rateLimiter(context *gin.Context) {<br> ip := context.ClientIP()<br> mutex.Lock()<br> defer mutex.Unlock()<br> count := ipRequestsCounts[ip]<br> if count &gt;= maxRequests{<br>  context.AbortWithStatus(http.StatusTooManyRequests)<br>  return<br> }<br><br> ipRequestsCounts[ip] = count + 1<br> time.AfterFunc(perMinutePeriod, func() {<br>  mutex.Lock()<br>  defer mutex.Unlock()<br><br>  ipRequestsCounts[ip] = ipRequestsCounts[ip] - 1<br> })<br><br> context.Next()<br>}<br><br>// rest of implementation same as above<br><br>func main() {<br> // Just one more line to add our rate limiter in router.<br> router.Use(rateLimiter)<br>}</pre><p>IP-based rate limiting has limitations stemming from shared IP addresses, dynamic IP allocations, susceptibility to DDoS attacks etc. These challenges can lead to unfair restrictions, difficulties in tracking individual behaviour, false positives or negatives for larger user groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*-sm2TU08Qd9VDBGRxnxBXg.gif" /><figcaption>Agreed?</figcaption></figure><h4>User-ID based rate limiting</h4><p>Another approach that could be considered is incorporating a user-ID header along with the IP address. This method involves keeping a count for each IP and user-ID combination. However, One potential drawback is that attackers can easily manipulate the user-ID, allowing them to exploit the system by using different IPs and user IDs.</p><h4>Token Bucket Algorithm</h4><p>This algorithm adds tokens to a fixed-size bucket at a constant rate. Each request consumes a token from the bucket, and if the bucket is empty, new requests are rejected. This technique helps control the rate of requests and prevents excessive traffic or overload.</p><pre>package main<br><br>import (<br> &quot;math/rand&quot;<br> &quot;net/http&quot;<br> &quot;github.com/gin-gonic/gin&quot;<br> &quot;sync&quot;<br> &quot;time&quot;<br>)<br><br>type RateLimiter struct {<br> tokens int<br> maxTokens int<br> refillRate int<br> mutex  sync.Mutex<br>}<br><br>func NewRateLimiter(maxTokens, refillRate int) *RateLimiter {<br> return &amp;RateLimiter{<br>  tokens:     maxTokens,<br>  maxTokens:  maxTokens,<br>  refillRate: refillRate,<br> }<br>}<br>func (rl *RateLimiter) RefillTokens() {<br> for {<br>  time.Sleep(time.Second)<br>  rl.mutex.Lock()<br>  if rl.tokens &lt; rl.maxTokens {<br>   rl.tokens++<br>  }<br>  rl.mutex.Unlock()<br> }<br>}<br><br>func (rl *RateLimiter) AcquireToken() bool {<br> rl.mutex.Lock()<br> defer rl.mutex.Unlock()<br><br> if rl.tokens &gt; 0 {<br>  rl.tokens--<br>  return true<br> }<br> return false<br>}<br><br>func getVisits(context *gin.Context, rateLimiter *RateLimiter) {<br> if rateLimiter.AcquireToken() {<br>  context.IndentedJSON(http.StatusOK, rand.Intn(1000))<br> } else {<br>  context.AbortWithStatus(http.StatusTooManyRequests)<br> }<br>}<br><br>func main() {<br> // Create a rate limiter with a maximum of 1 tokens and refill rate of 2 tokens per second<br> rateLimiter := NewRateLimiter(1, 2)<br><br> // Start the token refill routine<br> go rateLimiter.RefillTokens()<br><br> router := gin.Default()<br> router.GET(&quot;/getVisits&quot;, func(context *gin.Context) {<br>  getVisits(context, rateLimiter)<br> })<br> router.Run(&quot;localhost:8080&quot;)<br>}</pre><h4>Leaky Bucket Algorithm</h4><p>In the leaky bucket algorithm technique, requests are added to a bucket as they arrive and removed from the bucket for processing at a fixed rate. If the bucket fills up, additional requests are either rejected or delayed. This bucket can be a message queue.</p><pre>package main<br><br>import (<br> &quot;math/rand&quot;<br> &quot;net/http&quot;<br> &quot;github.com/gin-gonic/gin&quot;<br> &quot;go.uber.org/ratelimit&quot;<br>)<br><br>var limiter ratelimit.Limiter<br><br>func init() {<br> limiter = ratelimit.New(100) // 100 requests per second<br>}<br><br>func getVisits(context *gin.Context) {<br> if limiter.TakeAvailable(1) == 0 {<br>  context.JSON(http.StatusTooManyRequests, gin.H{&quot;message&quot;: &quot;Rate limit exceeded&quot;})<br>  return<br> }<br><br> context.IndentedJSON(http.StatusOK, rand.Intn(1000))<br>}<br><br>func main() {<br> router := gin.Default()<br> router.GET(&quot;/getVisits&quot;, getVisits)<br> router.Run(&quot;localhost:8080&quot;)<br>}</pre><p>This leaky bucket implementation is from a very famous GO-Lang <a href="https://github.com/uber-go/ratelimit">Repo</a>.</p><p>However, these algorithms have limitations in terms of their usefulness. For instance, they may not be suitable for implementing rate limiting on a login/signup page because they apply restrictions globally rather than on a per-request basis. Instead, these algorithms are more efficient when used for rate limiting calls to a database from servers or processing specific types of messages or for similar endpoints on Web server. Algorithms can be efficient in some cases, but they may not always be effective in another. Systems often rely on IP addresses, user IDs, or machine learning models to detect bots, but there are pros and cons to consider. Success depends on what works for a particular system. However, rate limiting bots and logout users pose challenges when there is limited information about user identities. Hence different languages such as Java and .NET provide various packages for rate limiting unauthenticated users in middleware by utilizing IP or similar configurations.</p><p>If you learned something new today or have reached this point, please give it a clap and do share in comments if you faced this problem and how did you approach. Cheers! 🙏</p><p>~Sooraj</p><p>Popular Rate limiting Repos In GO-Lang:</p><ul><li><a href="https://github.com/mennanov/limiters">GitHub - mennanov/limiters: Golang rate limiters for distributed applications</a></li><li><a href="https://github.com/didip/tollbooth">GitHub - didip/tollbooth: Simple middleware to rate-limit HTTP requests.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65fafed08157" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark side of Persisting Serialized Objects in SQL]]></title>
            <link>https://medium.com/@iSooraj/dark-side-of-persisting-serialized-objects-in-sql-c9eb06bfb29b?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9eb06bfb29b</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[serialization]]></category>
            <category><![CDATA[recent]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[issues]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Sat, 06 May 2023 12:52:07 GMT</pubDate>
            <atom:updated>2023-05-06T12:52:07.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUvHMBHgV9x25VpEqVTgww.png" /></figure><p>We often encounter projects that require us to store domain objects in a database. What do you do? In this article, we’ll examine the potential issues of storing serialized objects in a SQL database column using a real-life example. Additionally, I’ll share a few approaches for handling such objects.</p><p>Let’s assume we have an object like this:</p><pre>public class User<br>{<br>    public string FirstName { get; set; }<br>    public string LastName { get; set; }<br>    public int Age { get; set; }<br>}</pre><p>To begin, we’ll create a user table in our database with three columns: first name, last name, and age. Very easy!!!.<br>As is often the case in software development, requirements can change over time. In this scenario, we’ve added new features that require us to collect additional data about our users. As a result, our user object has been expanded and now includes more properties.</p><pre>public class User<br>{<br>    public string FirstName { get; set; }<br>    public string LastName { get; set; }<br>    public int Age { get; set; }<br>    public IEnumerable&lt;Permission&gt; Permissions { get; set; }<br>}<br><br>public class Permission<br>{<br>    public string Name { get; set; }<br>    public IEnumerable&lt;Resource&gt; Resources { get; set; }<br>}<br><br>public class Resource<br>{<br>    public string Name { get; set; }<br>    public string Path { get; set; }<br>}</pre><p>Well, we could redesign the database schema and spend countless hours on it, but who has time for that when product is already in production? Let’s just serialize the permission list to a string and call it a day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Nq7yKTa-xTSBycLqL3WFOQ.jpeg" /><figcaption>Yes you did it!!.</figcaption></figure><p>Now that we have completed the task by serializing the permission list, it’s worth considering the potential problems that could arise from this approach.</p><p><strong>Performance Impact while Read/Write:<br></strong>Storing permission lists as serialized strings in the database may result in performance issues as the dataset grows and queries become more frequent. Serializing and Deserializing can consume significant CPU resources, causing a bottleneck.</p><p><strong>Hard to Maintain Data Consistency:<br></strong>What happens if you change the structure of your serialized object? Maybe you add a new property or rename an existing one. Suddenly, all the serialized objects in your database are invalid! You’ll need to go through and update every row to make sure it conforms to the new structure. That’s a huge pain, and it’s error-prone. Plus, what if you miss a row or two? You’ll end up with inconsistent data, and that’s never a good thing.</p><p><strong>Partial Updates Not Possible:<br></strong>Updating serialized objects requires parsing and re-serializing the entire object, which can be slow and resource-intensive.</p><p>Looks like our User object is stuck with a messy data structure — a serialized Permission List with nested Resources. While using a table that contains a text/varchar column with a serialized domain object, there are numerous challenges and potential issues that can arise during querying, updating, searching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*yLr_dK__licfyrA9XQpVhQ.gif" /></figure><p>Considering the circumstances described, there may be various challenges that could emerge if a similar project was undertaken. Although the solution proposed may be useful for smaller projects, it may not be the optimal approach for more complex outings. Therefore, it would be worthwhile to consider alternative solutions. Let’s explore some potential strategies to tackle these challenges.</p><p><strong>Normalize the data model: </strong>One possible solution is to collaborate with our database team to analyze and normalize our data model. This involves creating separate tables for different entities, such as user permissions and resources, in order to improve data organization and reduce redundancy. By taking these steps, we can enhance the efficiency and effectiveness of our data management practices.</p><pre>CREATE TABLE [dbo].[User]<br>(<br>    [UserId] INT PRIMARY KEY,<br>    [FirstName] NVARCHAR(50) NOT NULL,<br>    [LastName] NVARCHAR(50) NOT NULL,<br>    [Age] INT NOT NULL<br>)<br><br>CREATE TABLE [dbo].[Permission]<br>(<br>    [PermissionId] INT PRIMARY KEY,<br>    [Name] NVARCHAR(50) NOT NULL<br>)<br><br>CREATE TABLE [dbo].[Resource]<br>(<br>    [ResourceId] INT PRIMARY KEY,<br>    [Name] NVARCHAR(50) NOT NULL,<br>    [Path] NVARCHAR(255) NOT NULL<br>)<br><br>CREATE TABLE [dbo].[PermissionResource]<br>(<br>    [PermissionId] INT NOT NULL,<br>    [ResourceId] INT NOT NULL,<br>    CONSTRAINT [PK_PermissionResource] PRIMARY KEY CLUSTERED ([PermissionId], [ResourceId]),<br>    CONSTRAINT [FK_PermissionResource_Permission] FOREIGN KEY ([PermissionId]) REFERENCES [dbo].[Permission] ([PermissionId]),<br>    CONSTRAINT [FK_PermissionResource_Resource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource] ([ResourceId])<br>)<br><br>CREATE TABLE [dbo].[UserPermission]<br>(<br>    [UserId] INT NOT NULL,<br>    [PermissionId] INT NOT NULL,<br>    CONSTRAINT [PK_UserPermission] PRIMARY KEY CLUSTERED ([UserId], [PermissionId]),<br>    CONSTRAINT [FK_UserPermission_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([UserId]),<br>    CONSTRAINT [FK_UserPermission_Permission] FOREIGN KEY ([PermissionId]) REFERENCES [dbo].[Permission] ([PermissionId])<br>)</pre><p>Thats how our Normalized DB schema for our current case will look like :p. And to Select all permissions and resource for a user.</p><pre>SELECT u.UserId, u.FirstName, u.LastName, u.Age, p.PermissionId, p.Name AS PermissionName, r.ResourceId, r.Name AS ResourceName, r.Path<br>FROM [dbo].[User] u<br>JOIN [dbo].[UserPermission] up ON u.UserId = up.UserId<br>JOIN [dbo].[Permission] p ON up.PermissionId = p.PermissionId<br>JOIN [dbo].[PermissionResource] pr ON p.PermissionId = pr.PermissionId<br>JOIN [dbo].[Resource] r ON pr.ResourceId = r.ResourceId<br>WHERE u.UserId = &lt;UserId_here&gt;<br>ORDER BY u.UserId, p.PermissionId, r.ResourceId;</pre><p>Although eliminating serialization and deserialization and ensuring flexibility for future changes have undoubtedly reduced the workload on our CPUs, we cannot overlook the fact that we now face the challenge of executing complex queries and joins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*aO2YGJI_C4Ix4pcTYHgwwg.jpeg" /></figure><p>While there are alternative approaches to address the serialization problem in SQL databases, Normalization is often considered the preferred solution for avoiding column serialization.</p><p>Let’s explore a solution in the NoSQL world and see how it can help us manage certain types of objects more effectively.</p><p><strong>Using MongoDB:</strong></p><pre>{<br>  _id: ObjectId(&quot;SomeGUID&quot;),<br>  FirstName: &quot;Sooraj&quot;,<br>  LastName: &quot;Kumar&quot;,<br>  Age: 24,<br>  Permissions: [<br>    {<br>      Name: &quot;Read&quot;,<br>      Resources: [<br>        {<br>          Name: &quot;Resource 1&quot;,<br>          Path: &quot;/path/to/resource1&quot;<br>        },<br>        {<br>          Name: &quot;Resource 2&quot;,<br>          Path: &quot;/path/to/resource2&quot;<br>        }<br>      ]<br>    },<br>    {<br>      Name: &quot;Permission 2&quot;,<br>      Resources: [<br>        {<br>          Name: &quot;Resource 3&quot;,<br>          Path: &quot;/path/to/resource3&quot;<br>        }<br>      ]<br>    }<br>  ]<br>}</pre><p>This is how our data will look like in a NoSQL database. And our Select Query will boil down to..! :p</p><pre>db.users.findOne({ FirstName: &quot;Sooraj&quot; })</pre><p>This may appear to be a simple solution, but it may not be the most suitable option when dealing with large systems and complex requirements. While migrating from a NoSQL to a SQL database is not always the easy choice, there are various other approaches that can help avoid the need to serialize objects and store them in a database column. These approaches can also be implemented within the existing database infrastructure, without the need for migration or the loss of backward compatibility. And obviously serialization is not one of those :p .</p><p>If you’re still reading, I hope this article has been helpful and given you some new perspectives to consider. Thank you 🙏 for taking the time to engage with this content. If you enjoyed it, please consider clapping and sharing your thoughts in the comments below. Peace..!</p><p>~ Sooraj</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9eb06bfb29b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dogpile effect, ft. Caching]]></title>
            <link>https://medium.com/@iSooraj/dogpile-effect-ft-caching-c2b9c4496691?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2b9c4496691</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[caching-data]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Sun, 02 Apr 2023 08:57:07 GMT</pubDate>
            <atom:updated>2023-04-02T08:57:38.392Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what happens when your cache expires or when lots of entries in your cache invalidate at the same time? The answer is the DogPile effect, a phenomenon that can put a significant load on your backend servers and cause slow response times or even downtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXE1iFWyR-Tjp9KoXEqgpg.png" /><figcaption>DogPile</figcaption></figure><p>Consider a website that displays the top-selling products of the month on its homepage. The website uses caching to store the results of a computationally expensive query that retrieves this data from the database. The cache is set to expire after one hour. On a particular day, one of the top-selling products is featured in a national news article, causing a sudden surge of traffic to the website. As a result of the increased traffic, the top-selling product changes frequently, and the cache becomes invalid as a result. This means that every request for the top-selling products must be processed by the database, which can cause a significant load on the server. Because the website is experiencing a high volume of traffic, the cache is unable to keep up with the changes in the top-selling product, and the database must handle every request As a result, the server may become overloaded, leading to slow response times or even downtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*fTU3TtKWzrXcKonpF4ATIg.png" /><figcaption>Sudden Spike</figcaption></figure><p>Now the problem is clear, I’m sure that even if you haven’t heard of the term “DogPile” effect, you would have faced it sometime on your servers as a backend engineer. A sudden spike in traffic can be caused by various other reasons as well. But the DogPile effect can be one of those many reasons to scratch your head during a Black Friday. Let’s see how to solve this :p !!</p><ol><li><strong>Cache expiration Randomization: </strong>Randomizing the expiration time of cached resources within a certain range. Seems like a brilliant idea?? it comes with a catch: it could either result in unnecessarily burdening the server or serving stale data to clients. What a delightful game of chance! <br>Randomizing the expiration time of cached resources can be a good fit for systems where the cost of serving stale data is relatively low, and the benefits of reducing server load outweigh the potential downsides.</li><li><strong>Cache locking: </strong>Locking approach aims to avoid multiple concurrent requests from going through the cache by acquiring an exclusive lock. This means that only those who can acquire the lock can update the cache, access the database, and other requests must wait until the lock is released. The approach also verifies if the cache has been updated to avoid duplicate database accesses.<br>However, this approach has several drawbacks. First, it reduces concurrency since only one request can access the cache at a time. Second, the waiting time is an extra overhead that consumes resources and affects performance.</li><li><strong>Stale-while-revalidate: </strong>known as warm-up caching, is a strategy where a server returns a stale cached resource to clients while it asynchronously generates a new version of the resource in the background. While this can lead to faster response times, it has the potential downside of clients receiving outdated data if the resource is frequently updated. Additionally, this approach requires storing both the stale and new versions of the resource in the cache simultaneously, which can increase resource usage.</li></ol><p>By now, you might be wondering how Redis, Memcached, DynamoDB, and other modern caching tools handle the infamous dog pile effect. Well, fear not, because these tools have some tricks up their sleeves to keep the backend system from getting overloaded. Redis uses cache locking to ensure that only one request at a time can regenerate the cache for a specific key. DynamoDB uses conditional updates to check if the cache key for a resource exists and generate data only if necessary. Lastly, Memcached uses cache stampede protection to set temporary flags on the cache key and prevent all other requests from accessing the cache until the data is available. So, the next time the dog pile effect threatens to take down your backend, these caching tools will be ready to handle it with ease.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*tlKACjAtUmb4xsRD0Y4d9w.png" /><figcaption>You got it :p</figcaption></figure><p>Well, well, well, it seems like we’ve stumbled upon the dog pile effect in caching. But fear not, dear engineer, for there are several approaches to avoid this pesky little problem. However, let’s not jump the gun just yet. Each solution comes with its own set of drawbacks that should be carefully considered before implementation. You don’t want to trade one problem for another, do you?</p><p>Cache locking may be a suitable solution for scenarios where cache regeneration takes a significant amount of time, but be warned, it may result in some impatient users staring at their screens and muttering unkind words under their breath. As for cache expiration randomization, well, it’s a great fit for applications where data updates are infrequent. Just keep in mind that you might have to sacrifice some data freshness for the sake of reducing server load. Tough choice, I know.</p><p>In the end, it all boils down to your unique circumstances. So, put on your thinking cap and evaluate your options carefully. Who said caching was easy anyway? But hey, you got this!!</p><p>Cheers !! <br><em>~Sooraj</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2b9c4496691" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resilient Services using Polly]]></title>
            <link>https://medium.com/@iSooraj/resilient-services-using-polly-7ff217cbd68?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ff217cbd68</guid>
            <category><![CDATA[resilience]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[fault-tolerance]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[polly]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 09:41:54 GMT</pubDate>
            <atom:updated>2022-12-24T09:41:54.649Z</atom:updated>
            <content:encoded><![CDATA[<p>Resilience is a closely related concept to fault tolerance and refers to the ability of a system to recover from failures and continue functioning properly. In the context of microservices, resilience is important because it enables the system to quickly bounce back from disruptions and continue providing value to users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuq59TXSBO__qCI3JHRYsQ.jpeg" /><figcaption>Bounce Back</figcaption></figure><p>Microservices architectures often involve complex systems with multiple interconnected components. This can make it difficult to predict and prevent all potential failures. By designing microservices with resilience in mind, we can ensure that the system is able to recover from failures and continue serving user requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*DH4_LjyLVQNE1WrtEOtDCA.jpeg" /><figcaption>Break the pattern</figcaption></figure><p>There are various strategies that can be used to achieve resilience in microservices, such as load balancing, horizontal scaling, and circuit breakers. Tools like the Polly NuGet package can make it easier to implement these strategies in .NET applications. By building resilience into our microservices, we can help to ensure the reliability and availability of the system and provide a better experience for users.</p><p><strong>What is Polly?</strong> Polly is a .NET library that provides resilience and transient fault-handling capabilities for .NET applications. It allows developers to define policies for handling failures, such as retrying failed requests or falling back to a default value. These policies can be applied to HTTP requests, database connections, and other types of external dependencies.</p><p><strong>How does Polly work?</strong> Polly works by wrapping a block of code in a policy and executing it. If the code throws an exception, the policy determines how to handle the failure. For example, a retry policy might retry the code a certain number of times before giving up and throwing the exception. A fallback policy might return a default value or execute an alternative action instead.</p><p>Here are a few examples of how you might use Polly in your microservices:</p><ul><li>Retrying a failed HTTP request:</li></ul><pre>var policy = Policy.Handle&lt;HttpRequestException&gt;().Retry();<br><br>await policy.ExecuteAsync(() =&gt;<br>{<br>    // Perform the HTTP request here<br>});</pre><ul><li>Falling back to a default value when an external dependency fails:</li></ul><pre>var policy = Policy.Handle&lt;Exception&gt;().Fallback(() =&gt; &quot;Default value&quot;);<br><br>var result = await policy.ExecuteAsync(() =&gt;<br>{<br>    // Perform the external dependency call here<br>});</pre><p>Polly was a great help in implementing the <a href="https://getakka.net/articles/utilities/circuit-breaker.html#:~:text=A%20circuit%20breaker%20is%20used,from%20bringing%20down%20all%20components.">circuit breaker</a> pattern in my .NET application. The library provides a simple and flexible way to define policies for handling failures and transient faults, such as retries, fallbacks, and circuit breakers. Using the Circuit Breaker method, I was able to configure a policy that would break the circuit after a certain number of exceptions occurred within a specified time window. This helped to prevent overloading an external dependency and ensured that the system remained stable even in the face of failures. The Polly library made it easy to add this important resilience feature to my application without having to write a lot of boilerplate code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*XAF9EXPZPiyzD_p1i5BQ2w.gif" /><figcaption>Polly :P</figcaption></figure><p>Here is an example snippet of how my scenario looked.</p><pre>using Polly;<br>using System;<br>using System.Net.Http;<br><br>namespace MyApplication<br>{<br>    public class CircuitBreaker<br>    {<br>        private readonly Policy _circuitBreakerPolicy;<br>        private readonly HttpClient _httpClient;<br><br>        public CircuitBreaker()<br>        {<br>            _httpClient = new HttpClient();<br>            _circuitBreakerPolicy = Policy<br>                .Handle&lt;Exception&gt;()<br>                .CircuitBreaker(<br>                    exceptionsAllowedBeforeBreaking: 3, <br>                    durationOfBreak: TimeSpan.FromSeconds(30));<br>        }<br><br>        public async Task&lt;string&gt; MakeHttpRequest(string url)<br>        {<br>            return await _circuitBreakerPolicy.ExecuteAsync(async () =&gt;<br>            {<br>                var response = await _httpClient.GetAsync(url);<br>                response.EnsureSuccessStatusCode();<br>                return await response.Content.ReadAsStringAsync();<br>            });<br>        }<br>    }<br>}</pre><p>There are several benefits to using Polly in your microservices:</p><ul><li>It helps to isolate failures and prevent them from cascading and taking down the entire system.</li><li>It provides a simple and flexible way to add resilience to your services without having to write a lot of boilerplate code.</li><li>It supports a wide range of policies and features, including retries, circuit breakers, timeouts, and more.</li></ul><p>In conclusion, the Polly NuGet package is a powerful tool for adding resilience to your .NET microservices. It provides a simple and flexible way to handle failures and maintain the stability of your system. Give it a try and see how it can improve the reliability of your services.</p><p>Thank you for reading my article on using the Polly NuGet package to implement resilience in .NET microservices. If you found the article helpful, please consider giving it a clap 👏 or two to let me know!</p><p>I would also love to hear about your experiences with implementing resilience in your applications. Please feel free to share your thoughts and insights in the comments below. How have you achieved resilience in your applications? What tools or techniques have you found to be most effective?</p><p>Thanks again for reading, and I look forward to hearing from you in the comments! Cheers 🥂..</p><p><em>~Sooraj Kumar</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ff217cbd68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pagination with Progressive Caching]]></title>
            <link>https://medium.com/@iSooraj/pagination-with-progressive-caching-14ce21e5c245?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/14ce21e5c245</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[pagination]]></category>
            <category><![CDATA[caching]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Wed, 07 Dec 2022 15:37:34 GMT</pubDate>
            <atom:updated>2022-12-07T15:37:34.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*bgHfYTJa6nVAeDX95V29xg.jpeg" /><figcaption>Approach</figcaption></figure><p><strong>What is Cache? </strong>Caching is the technique of storing copies of frequently used application data in a layer of smaller, faster memory to improve data retrieval times, throughput.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*RSAGU16IkVn4myDjzeSHtQ.png" /><figcaption>Caching</figcaption></figure><p><strong>What is Pagination? </strong>Pagination is the process of separating data into sets, Just like the pages of a book. A GET API request to request information from a server via an API endpoint to large databases could yield millions, if not billions, of results. The API response sending us thousands of entries at once is a drain of resources. Paging helps scale our application, serve more users, efficient querying, and create a good consumer experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*2lIhKDumNkl9FkWpoBug4A.png" /><figcaption>Pagination</figcaption></figure><p><strong>Let’s consider a scenario : </strong>You are assigned a task to develop a service. That will have endpoints serving records from different database tables. For now, let’s consider you start with an endpoint that serves from the products table from your database. The API supports some filter parameters. Let’s say PriceRange, Manufacturer, etc. Considering there are 5million+ products in your database. And your vendors keep adding more products to the database.</p><p><strong>Initial Thoughts : </strong>One may think of creating a database query against the API resource and filter parameter and running it in pushdown in the database read all the filtered records, store it in some cache and serve paginated responses from the cache for subsequent requests.</p><p>Imagine if the query result returned 2 million records. Will you cache (2 million — pageSize) records? Also, first request’s response time will be huge. As you are loading all 2 million records at once irrespective of page size. And when to invalidate the cache. It is already storing a large amount of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*IlzK-5Si7-budOQoYxNQeA.gif" /><figcaption>When to Invalidate Cache?</figcaption></figure><h4>My approach using progressive caching</h4><p>Bob goes for a buying Naan bread from the nearest restaurant. He observes that there are two people near an oven. One of them is shaping the floor into Naan bread. Another one on demand puts those shaped bread into the Oven and serves the order. He observes it the person on the Oven waits for a few seconds in case of any other order and leans back otherwise.</p><p>You got this Right? Work on demand, pause for a while dispose otherwise. That is exactly how I solved this problem. Now let’s map this into our scenario.</p><p><strong>Progressive Cache :</strong></p><p>Our cache key is GUID. That will be used here as a cursor parameter for our pagination. The value is the paused reader. We can implement a cache using the LRU cache. Also, an additional timer that ticks after every 8 seconds (can be user configurable) disposes of the least recently used reader. So we don’t keep database connections open for long.</p><pre>public interface ICache<br>{<br>  void Add(Guid Key,IReader reader);<br>  IReader Get(Guid Key);<br>  void DisposeUnwanted();<br>}</pre><p><strong>Using SQL Database :</strong></p><blockquote><strong>First Request</strong></blockquote><pre>Example request: https://localhost:9261/Products?Price=100&amp;Manufacturer=HP</pre><p><strong>Step 1 : </strong>Map your API query to a DB query.</p><pre>//Converted Query for our example request.<br>SELECT * FROM products WHERE Price = 100 AND Manufacturer Like &#39;HP&#39;</pre><p><strong>Step 2 : </strong>Execute the query on the database and read the record till your limit count.</p><p><strong>Step 3 : </strong>Pause the reader, Generate GUID, and Cache it.</p><p><strong>Step 4: </strong>Add Generated GUID as your cursor for the next page in your JSON response body.</p><blockquote><strong>Subsequent Requests</strong></blockquote><pre>Example request: https://localhost:9261/Products?Price=100&amp;Manufacturer=HP&amp;Cursor=GUID</pre><p><strong>Step 1 : </strong>Try to get the reader from the cache against your cursor parameter value from the request.</p><p><strong>Step 2 : </strong>Resume reader and read the record till your limit count.</p><p><strong>Step 3 &amp; 4 : </strong>Same as the first request.</p><p><strong>Time Complexity : </strong>O(limit), Where the limit is the size of the response page.</p><p><strong>Pros :</strong></p><ol><li>No lazy loading.</li><li>Efficient use of resources.</li><li>Constant response time.</li><li>No complex queries. Which you would need to understand if you Pushdown the cursor parameter.</li></ol><p><strong>Cons:</strong></p><ol><li>Can’t read previous records. But that is not possible using cursor pagination by definition.</li></ol><p>You may think how this will work in distributed environment where to put your cache. You can use something similar to <a href="https://www.google.com/search?q=Stikysession+by+ingnix&amp;rlz=1C1GCEU_enPK996PK996&amp;oq=Stikysession+by+ingnix&amp;aqs=chrome..69i57j33i10i160l3.11283j1j7&amp;sourceid=chrome&amp;ie=UTF-8">sticky sessions</a> supported by load balancers such as Nginx.</p><blockquote>Yes, life is easy, If you can code it.</blockquote><p>This progressive caching model can fit with other data sources such as Files, Documents. (We need a separate expression processor for where clause as we cannot push down in files). It also fits efficiently on your different database table schemas without caring much about its structure.<br>The model worked perfectly for me. I have seen people stuck in a similar situation on Stack Overflow and using lazy loading or some third-party implementation with extra overhead instead a simple solution. The approach shared is my own. So it may fit your use case. Please share your approaches in the comments.</p><p>And if you liked 👍 this article, hit that clap button below 👏. It means a lot to me and it helps other people see the story.</p><p><em>~Sooraj Kumar<br>Senior Software Engineer @ Astera Software</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14ce21e5c245" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS requests with V4 Signature using RestSharp]]></title>
            <link>https://medium.com/@iSooraj/aws-requests-with-v4-signature-using-restsharp-da121977bcfb?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/da121977bcfb</guid>
            <category><![CDATA[aws-signer]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[restsharp]]></category>
            <category><![CDATA[servers]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Wed, 16 Nov 2022 12:04:23 GMT</pubDate>
            <atom:updated>2022-11-16T16:21:11.795Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ekkofhEwvoT1NNWrKYOVQA.png" /></figure><p>AWS APIs use Signature Version 4 (SigV4) to add authentication information to requests sent over HTTP. For security, to consume any of your APIs deployed on AWS or a file upload/download call on your S3 Bucket, You need to sign your request using the Sigv4 algorithm to make a successful request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mGq5aWzQLhmYwC9wpTSTVg.png" /><figcaption>AWS V4 Signature</figcaption></figure><p>Most requests to AWS must be signed with an access key. The access key consists of an access key ID and secret access key, which are commonly referred to as your security credentials.</p><p>AWS Signature Version 4 is a complex algorithm. You need to structure request parameters, headers, and body in a strict format and then create a string to sign that structure, and add it as an authorization header in your request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*e_zFk3pe3quISjeWyXQ2LQ.png" /><figcaption>SigV4</figcaption></figure><p>When an AWS service receives the request, it performs the same steps that you did to calculate the signature. AWS then compares its signature to the one you sent with the request. If the signatures match, the request is processed. If the signatures don’t match, the request is denied.</p><p>A few days back, I was working on a task using <a href="https://restsharp.dev/">RestSharp</a>. Which is Probably, the most popular REST API client library for NET. To allow our users to consume any AWS service using our API client, I researched on different NuGet packages, AWS SDK and git repos. But I was unable to find a solution which works seamlessly with RestSharp client and gets the job done. So I ended up writing my own lil program that would take a configured rest request object and AWS Signature 4 security credentials and sign any AWS request, e.g. execute-Api, S3 or different services.</p><p>Since I ran into this problem and found no solution but a lot of people asking for some magical algorithm on stack overflow. Here I am sharing my solution. Feel free to use <a href="https://github.com/SoorajKothari/Aws4SignerRestSharp">my solution</a> in similar problems and leave a star on the repository if you find this helpful.</p><p>My GitHub repo : <a href="https://github.com/SoorajKothari/Aws4SignerRestSharp">https://github.com/SoorajKothari/Aws4SignerRestSharp</a></p><p><em>~Sooraj Kumar<br>Senior Software Engineer @ Astera Software</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da121977bcfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Astera Data Services, How Secure?]]></title>
            <link>https://medium.com/@iSooraj/astera-data-services-how-secure-a73c88b67125?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a73c88b67125</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[ads]]></category>
            <category><![CDATA[asteradataservices]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Mon, 31 Oct 2022 05:13:42 GMT</pubDate>
            <atom:updated>2022-10-31T05:13:42.672Z</atom:updated>
            <content:encoded><![CDATA[<p>Digital transformation process of integrating digital technologies in all aspects of a business is becoming an imperative for organizations. The key to successful digital transformation is adoption of a data driven culture where <strong>Security </strong>is one of the key aspects of data driven culture. Lets see how Secure is <a href="https://www.astera.com/products/astera-data-services/">Astera Data Services</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWp7rxJh3Oqn5Fo8rbZuAw.jpeg" /><figcaption>Astera Data Services Security Inspection</figcaption></figure><p>Astera Data Service provides you complete control on every single API endpoint through controlled user access and tokens to enable secure data sharing. Create authorization and authentication security checks for every API according to your business requirements. It only allow consumers access APIs over HTTPs and supports <a href="https://www.devopsschool.com/blog/what-is-bearer-token-and-how-it-works/">bearer token authentication</a> which is implemented using Role based access control <a href="https://digitalguardian.com/blog/what-role-based-access-control-rbac-examples-benefits-and-more">RBAC model</a>.</p><p>Author can create <a href="https://docs.astera.com/projects/centerprise/en/10/getting-started/user-roles-and-access-control.html">users and assign them roles</a> consisting of endpoints. While API consumer would require to either get the access token through client application or by requesting for access token on public login endpoint through their credentials. The access token then can be used to send requests. Sounds easy yes? That&#39;s how you can use our easy security model to have complete control over <em>who can consume what.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*TJ6uYtq4fa7woYWIHPY_RQ.jpeg" /></figure><p>Lets look at another interesting problem and our solution, with the increasing popularity of cloud environments, most organizations find themselves in a hybrid situation. They have both on-premises and cloud environments in their IT infrastructure. Securely communicating and exchanging data across these environments is a significant challenge that most organizations face. There are numerous examples of these situations. For instance, an organization may have satellite locations spread across geography and is looking to push, access or consolidate data from these locations. Allowing access to servers inside satellite locations may not be feasible from an enterprise security perspective.</p><p>API Relay-Agent, a key feature in Astera Data Services, helps solve this problem. You can deploy a relay server in the cloud. In satellite locations, you can install an agent server that polls from a message queue on the relay server and processes any pending requests on that queue. With this architecture, authorized callers can access satellite endpoints via relay server. The <em>following diagram</em> provides an overview of the relay architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uiL6lOrTlpExnPumv1Rjkw.png" /><figcaption>Relay-Agent Architecture in Astera Data Services</figcaption></figure><p>Above solution can map on all similar scenarios when you have a private network and want to expose endpoints to known users with extra security. We also have strong resilience using <a href="https://learn.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker">circuit breaker pattern</a> so you don’t need to worry about situations when agent server is dead. We will provide some response to consumers so they don’t wait forever.</p><p>To help your organization adopt to data driven culture securely, We have much more exciting feature including OAuth2, Personal access token (PAT) and developer portal coming up..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0nXZCkoqFq8GDzML8V0cTQ.jpeg" /></figure><p>Visit our <a href="https://www.astera.com/products/astera-data-services/">website</a> for more information. Of course, the best way to measure security of Astera Data Services is to use it hands-on. Please reach out to <a href="/service/mailto:sales@astera.com">sales@astera.com</a> to request a trial or a personalized use case demo.</p><p><em>~Sooraj Kumar<br>Senior Software Engineer @ Astera Software</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a73c88b67125" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surprisingly easy way to build and Manage your APIs]]></title>
            <link>https://medium.com/@iSooraj/surprisingly-easy-way-to-build-and-manage-your-apis-89d90b1390f?source=rss-fdffa9582d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/89d90b1390f</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Sooraj]]></dc:creator>
            <pubDate>Fri, 21 Oct 2022 08:25:52 GMT</pubDate>
            <atom:updated>2022-10-21T11:15:28.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*0fsQQBynJAcZQY1xKeBK9w.png" /><figcaption>Astera Data Services</figcaption></figure><p>API development is usually done by programmers that are hard to recruit, train, and retain. According to the <a href="https://www.postman.com/state-of-api/a-day-week-or-year-in-the-life/#a-day-week-or-year-in-the-life">2022 Postman survey</a>, developers spend 30% of their time creating APIs through coding. This is a huge strain on scarce IT resources, and things aren’t getting any better because API management can feel like a walk through Jurassic Park at times. The process requires developing an understanding of the underlying technology stack, data sources such as database systems, ERP systems, third party APIs, security, logging, monitoring, and much more.</p><blockquote><em>Astera Data Services — Our API Management Platform — maintains our tradition of bringing high productivity, no-code approach to building and managing APIs.</em></blockquote><p>Astera Data Services handles all these complexities under the hood. Users work with an intuitive drag-drop interface to build and manage APIs. This ease of use is hugely consequential. Insulating users from technical complexity makes API development and management approachable to non-developers. This gives enterprises the ability to make this technology available to a wide group of users leading to companywide adoption of APIs as a means of data exchange and communication.</p><p>Astera Data Services is based on Astera’s innovative visual data pipeline builder and provides all the key features needed for building, testing, deploying, securing, and monitoring APIs. We provide built-in connectivity to a wide range of <a href="https://docs.astera.com/projects/centerprise/en/10/#sources-toc">data sources</a>. These include databases, ERP applications, file formats, web services, unstructured data, and <a href="https://docs.astera.com/projects/centerprise/en/10/#connectors-toc">more</a>.</p><blockquote>All the features for building and managing APIs are provided in a single, intuitive, integrated environment. This focus on usability, ease of learning, and automation which can save as much as 80% of the of API development and management time and cost.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*q7DJfG7Bb0iJ07cmrjAWPA.jpeg" /></figure><p>Astera Data Services is a canvas where you visually build a request processing pipeline. All API flows start with a Request and end with one or more Responses. Between Request and Response objects are data access, validations, transformations, and data manipulation actions. We provide a collection of transformations like sort, filter, join, merge, validate, and hundreds of transformation functions. These transformations can be map together to build powerful request processing pipelines. Also you can use your request context to manipulate your flow logic and control data exposure.</p><p>Our API building approach emphasizes continual testing and validation. While you are building an API, you can preview data at any step to make sure that. Once you finish designing flow according to your business logic it is also ready for production. You can also generate <a href="https://swagger.io/specification/">OpenApi Swagger documentation</a> for your APIs so you can directly import and start consuming.</p><p>With our built-in security framework on RBAC model that provides authentication and authorization features. Giving you complete control over your APIs and it usage. So you can relax…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ZQ4nmFWwzlTGFkqMgJYGWw.jpeg" /></figure><p>You must have faced instances when you are sending a file that may take time to process or are making a request that could require long processing time. In these situations, keeping the caller waiting can create a bad consumer impression and result in timeouts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IgarFaDh5aXhTBc7DHRjyw.jpeg" /></figure><p>To solve your this concern we support designing and publishing Asynchronous APIs. Where you can poll later for response or we will ping you on callback URL upon completion of processing.</p><p>Monitoring and logging the server offers a decent indicator of its responsiveness and availability — all in the interest of ensuring that your clients service is delivered without interruption. and server admin can have a peaceful sleep. Hence we provide complete logging and monitoring which can be controlled and visualized to gain insights. And this isn’t it we have more automation and features for you..!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*1O6sOctgPrCGYal_NPeyuw.jpeg" /></figure><blockquote>feeling like SpongeBob?</blockquote><p>Visit our <a href="https://www.astera.com/products/astera-data-services/">website</a> for more information. Of course, the best way to see the power of Astera Data Services is to use it hands-on. Please reach out to <a href="/service/mailto:sales@astera.com">sales@astera.com</a> to request a trial or a personalized use case demo.</p><p><em>~Sooraj Kumar<br>Senior Software Engineer @ Astera Software</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89d90b1390f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>