<?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 Arjun Chauhan on Medium]]></title>
        <description><![CDATA[Stories by Arjun Chauhan on Medium]]></description>
        <link>https://medium.com/@2503arjun?source=rss-2eb8b4a94e37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Ss493V2SoW5j4Lvs7wLM8w.jpeg</url>
            <title>Stories by Arjun Chauhan on Medium</title>
            <link>https://medium.com/@2503arjun?source=rss-2eb8b4a94e37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:47:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@2503arjun/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[Let’s Talk Time Series: Part 1(Goal Definition)]]></title>
            <link>https://2503arjun.medium.com/lets-talk-time-series-part-1-goal-definition-c199cc70be7d?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/c199cc70be7d</guid>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[time-series-forecasting]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 12:23:05 GMT</pubDate>
            <atom:updated>2025-06-10T12:23:05.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*P_kXByFCsFU0T3jg8rKEUw.png" /></figure><p>This is first part of my series on time series forecasting. I would be talking about every aspect of time series forecasting in detail in each part. Before beginning any task we need to have a clear idea of what our goal is and what we want to achieve.</p><p>In this article I would be giving the idea about what goes into planning a task for time series and give a brief on how to solve the challenges arise.</p><p>In the later articles I would talk about more technical terms. This would be an overview on what time series forecasting is all about.</p><h3>Time Series analysis vs Time series forecasting</h3><p>Time series forecasting and analysis are very closely related terms but there is a difference. The time series analysis refers to using the current data available to provide insights on the trends and seasonality in the data . This helps in making important business decisions. In certain cases the time series analysis can use the values from the future to provide better insights for the value today too.</p><p>On the other hand the time series forecasting refers to using the existing data and using it to predict the values for the future.</p><p>Since the goal of the tasks is different in both these cases the methods employed to achieve them also differ. I would be focusing majorly on the time series forecasting, however some of the techniques are similar in both the tasks.</p><h3>Introduction</h3><p>Time series forecasting is unlike any other predictive analysis technique. This is because there is an element of time in it. The value at any certain time is dependent on the previous values. Hence keeping the tracking of previous values is also important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*9BYyYG6NzHBAFK463TKi9g.png" /></figure><p>Considering the diagram today we are dealing with the first part of defining goal. But this is a crucial task since this very task is going to act as a guide and constraint for all the tasks later.</p><h3>Goal definition?</h3><p>Before beginning any project or task we need to have a clear idea on what we want to achieve. This is important while dealing with time series forecasting too.</p><p>So what questions need to remembered before beginning:</p><ol><li>Do we need to do time series analysis or forecasting</li><li>Who would be using these forecast?</li><li>How far in the future we need to forecast. This is important because the when we go in the future the probability of the context being changed gets higher.</li><li>Is the process ongoing or you need to predict once.</li><li>How recent are the data available at the time of prediction?Timeliness of data collection and transfer directly affect the fore-cast horizon.</li></ol><p>Different answers will lead to different choices of data, forecasting methods, and evaluation schemes. Hence, these questions must be considered already at the goal definition stage.</p><p>Referring to point 3 the forecasting task can be an ongoing task or a single project that needs to be completed for a given time frame. For example predicting the weather is an ongoing procedure where we constantly predict the weather and the task is ongoing for any number of days. On the contrary predicting the number of cases of COVID-19 virus for the next month can be a single task.</p><h3>Roll-forward forecasting</h3><p>As I mentioned earlier that it is important to know about how far in the future we want to predict the values. The farther we go into the future the more the uncertainty increases.</p><p>Let’s say it is the January of 2021. The task is to predict the stock price of the next three month. We create a forecast in January to predict the price for the next three months. This forecast can be refreshed in february and again in march. This would make the forecast more robust when predicting the values for april. This refreshing of the forecasts based on new data is called roll-forward forecasting.</p><h3>Who would be using this forecasting?</h3><p>Before forecasting it is also important to know who would be viewing the forecasting and how they would like it to be presented. If this forecast is a part of some project pipeline then the forecast could be an input to some other component of the project or if it needs to be presented to the end user then it needs to be presented differently.</p><p>All these points needs to be considered before beginning the tasks.</p><h3>Conclusion</h3><p>Some might think that these intricate details might not play a major role when creating the forecast but a proper goal planning in the beginning save a lot of time later when we are trying to find the appropriate data, methods, and evaluation schemes which we would be discussing in the future articles.</p><p>Thanks :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c199cc70be7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Eventing with Kafka]]></title>
            <link>https://2503arjun.medium.com/learning-eventing-with-kafka-9bdab2d962e9?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bdab2d962e9</guid>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Sun, 11 Feb 2024 05:38:52 GMT</pubDate>
            <atom:updated>2024-02-11T05:38:52.261Z</atom:updated>
            <content:encoded><![CDATA[<p>As a working professional I recently got a chance to work on eventing. The whole process of publishing an event to a topic(don’t worry if you don’t get this term) and then consuming it was very seamless and I didn’t have to worry about if my code logic needs to implement any fault tolerance. My major focus remained on creating the payload I want to publish and the logic to consume the event.</p><p>On the surface level the abstraction provided by kafka SDK looks very minimalistic which is exactly the point of abstraction but I got curious and spent time understanding the structure of the whole kafka ecosystem.</p><p>In this article I would be focussing on talking about the infrastructure of the kafka ecosystem and how various components work together to give us a seamless experience while interacting with it.</p><p><strong>What is Kafka?</strong></p><p>Kafka was first developed at linkedin and subsequently open sourced in 2011. Back then linkedin started generating lots of data which they wanted to utilize to get insights. The data they collected was sitting in systems and generating no insights because lot of this data was on different systems. To generate value they needed to deliver it to the relevant locations(systems) where it could be effectively utilised.</p><p>When Linkedin developed Kafka it sat at a centre hub where the different systems connected to it to publish information and consume it. Since then we have come in a long way and so have the use cases.</p><p>So how do we define it? <strong>Kafka is a distributed streaming platform majorly used to create real-time data streams and process these real-time data streams.</strong></p><p>Any Kafka environment is broadly divided into three components:</p><ul><li>Producer</li><li>Consumer</li><li>Broker</li></ul><p>We would be going into the details about the structure of the system but first let’s understand some common terminologies.</p><h4>Common terms used</h4><ul><li>Producer: A producer is an application that sends data. Data in kafka is often called a message and sending is called publishing.</li><li>Consumer: A consumer is an application that receives messages. Receiving data is referred to as consuming data. So publishing and consuming are just embellishment for sending and receiving.</li><li>Broker: The producers and consumers don’t interact with each other directly. They do it through a broker. A broker is like a centralized server that receives messages from publisher and send it to the customer who needs it.</li><li>Cluster: A group of servers running the kafka broker is called a cluster.</li><li>Topic: A kafka topic is a unique name for a data stream. We will go in detail of what it is but for now you can think of it as a normal database table.</li><li>Topic partition: If we consider a topic as table then this table can exponentially increase in size. This is why we use topic partition. Each topic partition is responsible for handling a subset of data. Choosing the partition is a design decision made when we setup the infrastructure. Topic partitioning allows partitioning the data in a single broker.</li><li>Partition offset: This is a unique sequence id for a message. It is immutable and is helpful in locating a message. So to locate a particular message we need</li><li>Consumer Group: As the name suggests consumer group is a group of consumers working on a certain tasks consuming assigned partitions to solve collectively a larger task.</li></ul><h4>Leader vs Follower Broker</h4><p>For ensuring there is no data loss. The messages received by broker are replicated in multiple other brokers. This helps in ensuring there is no loss of messages in case a broker goes down. However it is not possible to replicate the same message in multiple brokers without any delay and is also not necessary.</p><p>One of the broker is assigned the task of being the leader broker. This broker is responsible for receiving the messages and all requests are directed to the leader broker only. The follower broker are supposed to keep reading the messages received to the leader broker.</p><p>Kafka maintains an ISR(in sync replicas) list which as the name suggests are the follower replicas which are in sync with the leader. This list is dynamic and nodes are constantly getting added and removed from it. The followers who are in sync with the leaders are the eligible candidates to be assigned the role of the leader if the current leader broker goes down.</p><p>In case the leader broker goes down one of the follower broker can be promoted to become a leader broker.</p><p>Now the question how will we determine if the broker is down or which of the follower broker are in sync with the leader and qualify for becoming the leader broker.</p><h4>Zookeeper</h4><p>For a particular kafka cluster zookeeper is a centralized server responsible majorly for the metadata management of the cluster. It stores information like the metadata about the brokers so that it is aware if a particular broker node goes down. Kafka is able to provide fault tolerance with the help of zookeeper.</p><p>Like mentioned above if the leader goes down a follower broker can be assigned the role of the leader. This whole process is managed by zookeeper. Zookeeper keeps itself updated with the metadata of the brokers and the follower broker who are in sync with the leader so that the correct follower can be assigned as the leader.</p><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*BnxE7Hg16sLZDQOgMblaHQ.png" /></figure><p>Now let’s go over a common use case using which we will understand the architecture and see the advantages of using Kafka and when it really shines.</p><p>Let’s go over a simple application that is responsible for capturing the weather data every 10 minutes. This data is going to be used by another application that would perform analysis on this data to alert the user on his phone if the weather is good enough for a nice stroll. This is a very simple example but my motive is to show how using kafka would make this problem a lot easier.</p><p>Let’s say we take a conventional approach not leveraging any messaging services. The application that is capturing the data about the weather can start storing the data in a database. The application who needs this data can query the database whenever he wants which is going to be every few mintues.</p><p>The challenge we are going to face is that the size of the database will keep on increasing gradually without any apparent benefit.(let’s assume we don’t need the data for anything else apart from the notification on the user’s phone.)</p><p>One argument for this approach would be that we can perform a cleanup on the database every few hours to make sure that we are not storing unneeded data. This is correct however but this just adds another layer of effort needed to make this approach work. Also let’s consider a case where the mobile application is failing and is not able to get the data from the database. If the cleanup happens before the application could get the data then we are in a position where our mobile application won’t work as expected.</p><h4>The Kafka Way</h4><p>Now let’s say we setup a kafka environment.</p><p>Now every 10 minutes the data can be pushed to the broker by the producer. In our case our application would require a producer created on it’s end with the endpoint for our broker specified. This does require an additional logic but the abstraction provided by kafka libraries make this work very easy.</p><p>So now we won’t need a database to store the data that is getting generated every 10 minutes.</p><p>The broker partitions are now responsible for storing this data until the consumer application consumes it.</p><p>Every 10 minutes the application can request the data from the broker and perform the actions based on this data. Again a consumer must be configured on the application but like said previously the abstraction provided makes it very easy.</p><p>Now let’s say this simple application gains lot of traction and the number of users using it multiplies. We can scale a kafka server a lot easier compared to a database.</p><p>In this article I gave a higher lever idea on the use and architecture of Kafka cluster.</p><p>There are a lot of things that are still to be discussed about the implementation part for the consumers and producers and what are the type of configurations we can provide. This would in turn give deeper understanding on how the whole system works. That is something I would like to discuss in a later blog.</p><p>Thanks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bdab2d962e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Reactive Programming]]></title>
            <link>https://2503arjun.medium.com/getting-started-with-reactive-programming-67af2669426d?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/67af2669426d</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 04:15:41 GMT</pubDate>
            <atom:updated>2023-07-17T04:15:41.861Z</atom:updated>
            <content:encoded><![CDATA[<p>Before the title misleads anyone I would like to clarify that the term “Reactive” might be ambiguous to some. What I would be covering in this blog is paradigm of programming that deals with handling non blocking asynchronous events and not the JS framework with the similar name.</p><h4>What are Non blocking asynchronous calls?</h4><p>Let’s say we have an API and we are handling a lot of requests. By architecture, synchronous calls are meant to be blocking. What it means by this is that until we receive the response from the server the application execution will be blocked. In contrary in case of asynchronous execution the application does not wait for the response from the server and hence is non blocking.</p><p>I wanted to be clear why asynchronous calls are non blocking by nature and so what we will be discussing in this blog is how reactive programming helps us in handling asynchronous events in our application.</p><h4>What are events?</h4><p>Events have varying definitions depending upon the context. Today we are discussing about reactive programming and in today’s case I would describe events as <strong><em>occurrences that happen over time and can be observed and reacted to by the application</em></strong><em>.</em></p><p>As I mentioned earlier reactive programming helps us in dealing with these events in a way that our application <strong>remains responsive and scalable</strong>.</p><h3>Getting Started</h3><p>One of the main goals of reactive programming is to provide a way to handle asynchronous data streams and events in a more efficient and scalable way.</p><p>The state of the application in reactive programming is built around data streams which are composed of events that happen over time. The change in the state or events can be processed by the application asynchronously and updated accordingly.</p><p>Reactive programming also involves handling back pressure, which is a mechanism for controlling the flow of data in the application to prevent overload and ensure stability. This is particularly important when dealing with large volumes of data streams and events which is often in the case of big applications.</p><h4>So how does reactive programming work?</h4><p>Reactive programming makes use of publishers and subscribers to handle data and events efficiently.</p><p>Next I would try to explain how reactive programming leverages the use of publisher-subscriber model.</p><ol><li>A publisher object is initialized that emits a stream of data or events over time.</li><li>One or more subscriber objects are created that register with the publisher to receive notification when new data is available. The subscribers can process the data asynchronously and update the state of the application accordingly. We can configure if an event can be consumed by one or multiple subscribers depending upon our use case.</li><li>We also have support for operators. Operators are functions that can be used to transform and combine data streams. They allow developers to create complex data flows by composing and transforming data streams using a set of functional programming techniques.</li><li>Then to make things scalable we have the usage of schedulers. Schedulers are used to control the concurrency and parallelism of the application. They allow developers to control how data streams are processed and ensure that the application is responsive and scalable.</li></ol><p>There are various frameworks available that provide an abstraction for reactive programming like RxJava, Reactor, Akka, and Spring WebFlux.</p><p>I would be going through one of them in today’s blog to provide a step-by-step guide as to how everything comes together.</p><h3>Reactor</h3><p>Reactor is a reactive programming library for building asynchronous and event-driven applications in Java. It is designed to handle large volumes of data streams and events in a scalable and efficient way. I have used reactor myself and the reason I decided to use it as the library for the demo today is because it is easy to understand and very beginner friendly.</p><p>The main use of Reactor is to provide a set of tools and abstractions for building reactive applications. It provides a set of core components, such as Flux and Mono, which represent streams of data and events. These components can be combined and transformed using a set of operators, such as map, filter, and reduce, to create complex data flows.</p><p>Before we go any further I would like to explain what are mono and flux as mentioned above.</p><h4>Mono vs Flux</h4><p>Like mentioned previously reactive programming works on publisher-subscriber model. Both Mono and Flux provide an abstraction to publish events.</p><p>The difference between them is that Mono can emit only one event at a time on the other hand Flux can emit multiple events at a time. So in case when we are sure that we only want to emit one event we can choose Mono on the other hand Flux can be used when we have to emit multiple events.</p><p>Now I would give a short example explaining every concept we have discussed so far.</p><h4>Demo</h4><p>Everything begins with the publisher emitting the event for the consumer to consume.</p><p>Like java streams both flux and Mono follow lazy execution i.e the value of the expression is not processed until it is needed.</p><p>Let’s start by creating a simple flux.</p><pre>  Flux&lt;Integer&gt; flux = Flux.just(1, 2, 3, 4, 5);</pre><p>The “just” method allows us to create a flux when we have the value available. This is the simplest way of creating a Flux. Even though I am giving an example of flux the steps remain the same for <strong>Mono </strong>as well. Even mono has a “just” method , the only difference being that Mono is used for only one item. So if we give multiple values we would get an error.</p><pre>Flux&lt;String&gt; mappedFlux = flux.map(i -&gt; &quot;Number: &quot; + i)</pre><pre>The above flux gets converted to<br>&quot;Number: 1&quot;, &quot;Number: 2&quot;, &quot;Number: 3&quot;, &quot;Number: 4&quot;, &quot;Number: 5&quot;</pre><p>Here we have used an operator to process our data. Remember I mentioned previously the usage of operators. Now I would take the time to list out a few common operators we can use.</p><ol><li><strong>Map</strong>: Transforms each item emitted by a data stream by applying a function to it.</li><li><strong>Filter</strong>: Filters items emitted by a data stream based on a predicate function.</li><li><strong>Reduce</strong>: Aggregates the items emitted by a data stream into a single value using an accumulator function.</li><li><strong>Merge</strong>: Combines multiple data streams into a single data stream.</li><li><strong>Concat</strong>: Concatenates multiple data streams into a single data stream in a specific order.</li><li><strong>FlatMap</strong>: Transforms each item emitted by a data stream into another data stream, and then flattens the resulting data streams into a single data stream.</li><li><strong>Zip</strong>: Combines the items emitted by multiple data streams into a single item using a combiner function.</li></ol><p>Let’s apply a few more operators to explain their working.</p><pre>Flux&lt;String&gt; filteredFlux = mappedFlux.filter(s -&gt; !s.endsWith(&quot;2&quot;) &amp;&amp; !s.endsWith(&quot;4&quot;));</pre><p>The flux gets converted to</p><pre>&quot;Number: 1&quot;, &quot;Number: 3&quot;, &quot;Number: 5&quot;</pre><p>Let’s reduce the flux now into a single string.</p><pre> Mono&lt;String&gt; reducedMono = filteredFlux.reduce(&quot;&quot;, (a, b) -&gt; a+ &quot;, &quot; + b);</pre><p>The flux gets converted to</p><pre>&quot;Number: 1, Number: 3, Number: 5&quot;</pre><p>What these steps represent is the the processing of the event. So we began with the raw event Flux of a list of numbers. We used the operators to process the events.</p><p><strong>A point to be noted is that I have added the converted output for explanation and no as such computation actually happens</strong>. Like mentioned previously the Flux follows lazy execution. Until we subscribe to the event flux no computation actually happens. And when we do subscribe we have the control on what we want to with the event we received.</p><p>To make things easy I would just print out the Flux to show how subscriber works .</p><pre>reducedMono.subscribe(System.out::println);</pre><p>Output</p><pre>&quot;Number: 1, Number: 3, Number: 5&quot;</pre><p>This is a very basic example of how flux works. We created an event. Processed it using operators then finally when we used the method subscribe the evaluation of that expression was done.</p><p>Now you might wonder that where does schedulers come into play on this one. Let’s discuss it then.</p><h4>Schedulers</h4><p>Schedulers are used to control the concurrency and parallelism of the application. They allow developers to control how data streams are processed and ensure that the application is responsive and scalable.</p><p>Schedulers provide a way to specify where and how the processing of a data stream should occur. They can be used to run tasks on a separate thread, on a thread pool, or on a specific executor. Schedulers can also be used to control the order in which tasks are executed, and to introduce delays or timeouts.</p><p>Reactor provides several built-in schedulers that can be used to control the processing of data streams:</p><ol><li><strong>Schedulers.immediate() </strong>: Runs tasks on the current thread.</li><li><strong>Schedulers.single()</strong>: Runs tasks on a single thread.</li><li><strong>Schedulers.parallel()</strong>: Runs tasks on a fixed-size thread pool.</li><li><strong>Schedulers.elastic()</strong>: Runs tasks on an unbounded thread pool that can grow or shrink dynamically.</li></ol><p>These can be used with methods like subscribeOn and publishOn to control where the events are evaluated.</p><p>If we are supposed to add a scheduler in the above case we can do by updating the subscribe call.</p><pre>reducedMono.subscribeOn(Schedulers.parallel()).subscribe(System.out::println);</pre><p>In this example subscribeOn is used as an operator to subscribe to the reduced mono on a separate scheduler. We use the Schedulers.Parallel method to create a parallel scheduler that can handle multiple threads. This allows us to process the data stream asynchronously and improve performance.</p><p>The output remains the same because we didn’t change the processing part of the execution.</p><p>Now we have discussed about publishing and subscribing. We also talked about the schedulers we have in reactor.</p><p>So are we missing something?</p><p>Well indeed we are. We are missing handling back pressure.</p><p>Let’s discuss that now.</p><h4>Backpressure Strategy</h4><p>In Reactor, backpressure handling is a mechanism for controlling the flow of data in the application to prevent overload and ensure stability. It is particularly important when dealing with large volumes of data streams and events. This is something we already have discussed. So let’s see how we can actually do it in code.</p><p>In Reactor, back pressure handling can be implemented with variety of strategy which reactor has inbuilt for us using onBackPressure___ .</p><p>The ___ can be replaced with the strategy name. I will discuss a few strategy support reactor have:</p><ol><li><strong>Buffer:</strong> If there are excess events coming up that the system can’t handle. It gets added to the buffer to be processed once the system gets available. This is the default strategy that is implemented.</li><li><strong>Drop: </strong>Drops incoming data when the Subscriber is unable to keep up with the rate of data production. Hence we might lose out on the events that come up faster than the speed of processing.</li><li><strong>Error:</strong> This strategy simply returns an error if it can’t process the incoming request.</li><li><strong>Latest:</strong> Keeps only the latest item emitted by the Publisher when the Subscriber is unable to keep up with the rate of data production. This is similar to “Drop” but here we only keep the latest data that is coming up and not the older.</li></ol><p>Let’s have an example now.</p><p>First let’s create a flux.</p><pre>Flux&lt;Integer&gt; flux = Flux.range(1, 1000);</pre><p>Here we didn’t use “just”. We used the range method to create a stream of integers as a flux.</p><p>Let’s use the Drop strategy for this example.</p><pre>Flux&lt;Integer&gt; droppedFlux = flux.onBackpressureDrop().onBackpressureDrop(10);</pre><p>Here we used the drop strategy to handle backpressure by dropping the oldest items in the buffer when the Subscriber is unable to keep up with the rate of data production. We set the buffer size to 10 here.</p><p>After we define the strategy for our case we can go ahead with using operators like we discussed earlier.</p><p>In this blog we discussed what reactive programming is and how we can use it. I have discussed a basic example and there are lots of things that Reactor has a support for. However it was beyond the scope of this blog since I wanted to just introduce the reader with it and not overwhelm. Probably in a later blog I would give a detailed example of how different operators and strategies can come together to help scale the application.</p><p><strong>Thanks</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67af2669426d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Story]]></title>
            <link>https://2503arjun.medium.com/javascript-story-c6720438f480?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6720438f480</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 04:52:13 GMT</pubDate>
            <atom:updated>2021-06-24T04:52:13.776Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BbX151iFP3oVYg-JFQgT2g.png" /></figure><p>JavaScript is what is known as a client-side script. Most Web applications, such as a search engine, work because of an interaction between the user’s device and a remote server. The software on the remote server sends information to the client and the software on the client side reads the information and renders a Web page on screen.</p><p>An HTML page is a static one and without JavaScript it would be static still. JavaScript can make the website more interactive and user- friendliness of JavaScript helps easy navigation of the website and helps designers to guide the visitors with additional information or guide them through walkthroughs. Visual effects can also be achieved with JavaScript. JavaScript can be used effectively to create special effects like rollover for images.</p><p>While JavaScript is not the only client-side scripting language on the Internet, it was one of the first and it is still the most widely used.</p><p>A client-side script is a programming language that performs its tasks entirely on the client’s machine and does not need to interact with the server to function. For instance, if you have a Web page loaded on your computer and your Internet service provider goes down, you are still able to interact with the Web pages already loaded on your browser. You will not, however, be able to navigate to new Web pages or access any data located remotely.</p><p>Any organization that has to deal with dynamic website and website is bound to use javascript in it’s tech stack.</p><p>This means that almost every organization deals with javascript on a regular basis</p><h3>The frameworks of javascript</h3><p>Javascript has various frameworks to support the frontend as well as backend framework. This is a very important fact because in the 21st century no ones want to wait and to create a web application from scratch is not something that attracts organizations</p><h4>Angular</h4><p>One of the most powerful, efficient, and open-source JavaScript frameworks is Angular. Google operates this framework and is implemented to use for developing a Single Page Application (SPA). It extends the HTML into the application and interprets the attributes to perform data binding.</p><h4>React</h4><p>Created by Facebook, the React framework has earned popularity within a short period. It is used to develop and operate the dynamic User Interface of the web pages with high incoming traffic. It makes the use of a virtual DOM, and hence, the integration of the same with any application is more straightforward.</p><h4>Vue.js</h4><p>Though developed in the year 2016, this JavaScript framework has already made its way into the market and has proven its worth by offering various features. Its dual integration mode is one of the most attractive features for creating high-end SPA or Single Page Application. It is a much reliable platform for developing cross-platform.</p><h4>Ember.js</h4><p>The introduction of Ember.js to the software market was 2015, and since then, it has gained popularity with its wide application area. The features of Ember.js support two-way data binding and hence, establish a reliable platform for handling the complicated User Interfaces. Popular websites like LinkedIn, Netflix, Nordstrom, and many more use the Ember.JS platform for their websites.</p><p>There are various other frameworks that are popular but the list is very long so I have mentioned the few of the most popular.</p><h3>Industry Use case:</h3><h3>Facebook</h3><p>You’re probably aware that Facebook uses JavaScript. It’s kind of hard to miss. What’s probably not as obvious is exactly how much JavaScript goes into making Facebook and how much Facebook is involved in JavaScript development.</p><p>Try disabling JavaScript in your web browser and going to Facebook. The website will actually stop you from logging in because it won’t work without JavaScript.</p><p>You may have noticed the way that Facebook loads. Each piece of the page is separate. Facebook has invented its own way of breaking down and delivering sections of JavaScript separately. In an odd way, each section of your Facebook page is a collection of independent JavaScript applications.</p><p>It doesn’t stop there. Facebook created <a href="https://facebook.github.io/react/">React</a>, one of the most popular front end frameworks. Facebook uses React on Facebook.com as well as Instagram and WhatsApp.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6720438f480" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a video chat application using openCV]]></title>
            <link>https://2503arjun.medium.com/creating-a-video-chat-application-using-opencv-b7a75a4ccf5c?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7a75a4ccf5c</guid>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Wed, 16 Jun 2021 14:44:15 GMT</pubDate>
            <atom:updated>2021-06-16T14:44:15.831Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*b5zqMOf7e8HzxlCxepsFpQ.png" /></figure><p>Today we would be creating a video chat application that will allow the users to see each other in real time. However I would not be integrating the voice transfer today.</p><p>So we would be using socket programming in python to send data and opencv to display the results.</p><p>Image is nothing but stacked arrays for the computer. So when we transmit image we are actually transferring arrays. This is a very important thing to keep in mind when we would be actually creating the application.</p><p>For the application we need two programs. One for the server and one for the client let’s begin with understanding the server side program first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*2GFuOxWE1khpJThXqNz_Sw.png" /></figure><p>So firstly we created a socket. We have used SOCK_STREAM which means that we are using the TCP protocol and AF_INET tells that we would be using the ipV4 protocol for our application</p><p>I am using the port number 9999 however any unused port can be used.</p><p>For any successful connection we need both the IP and the port number so we bind them using the connect function. Now when we need to transfer the video over the network we need to stream this data continuously. This is needed to maintain a constant video. For this we have used the while loop so that data keeps on transmitting.</p><p>We are transmitting 1024*4 bytes per image. This is mentioned in the client.recv() function. We however cannot just transfer the data so we first load it using the pickle.</p><p>For showing the video we are using the imshow(). We have kept all this process inside the True of while. This is done so that we can keep getting the data . Send it and also keep showing our image using imshow().</p><p>Now let’s look at the other code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4SqP67LHhC5AucJAtku0w.png" /></figure><p>For making a connection we need to connect to the server. We specify the ip of the host and the port we are going to connect to.</p><p>This is a simple task here we need to send the information to the server.</p><p>We use the similar dump function. This is send using the client_socker.sendall(). We are also showing the video that we are going to transmit.</p><p>This is similar to the server . We have to put all this code in the while loop so that it does not terminates.</p><p>Let’s see this code in action now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NllyaA5ZdAmZfmLIGqsFKQ.png" /></figure><p>Here when we run both the programs the video is transmitted and we can see both the recieving and transmitted video. Anyone connected within the same network can access the video chat application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7a75a4ccf5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Playing with OpenCV in Python]]></title>
            <link>https://2503arjun.medium.com/playing-with-opencv-in-python-43f0acbf3d42?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/43f0acbf3d42</guid>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Sat, 05 Jun 2021 06:30:41 GMT</pubDate>
            <atom:updated>2021-06-05T06:30:41.950Z</atom:updated>
            <content:encoded><![CDATA[<p>If anyone is starting off with computer vision using python as their programming language they are most likely to use openCV2 at some point or the other.</p><p>OpenCV is pretty easy to use with straightforward implementation of the functions.</p><p>In today’s article I would be giving an idea of this library with quite unconventional examples but they are gonna give a good impression on how this library can be leveraged on different use cases.</p><p>So I would be performing three simple tasks.</p><ul><li>Create a basic image using just numpy and cv2.</li><li>Crop image and replacing some part of it with another image</li><li>stacking two images together</li></ul><h3>Creating images with numpy and cv2</h3><p>Before I give the example I would like to give an idea of what an image is computationally. We see image as the object it represents however for cv2 it is just a numpy array with different values of BGR colours stacked together.</p><p>So if each image is a numpy array. We can create a numpy array to be rendered as an image.</p><p>So I would be creating a simple vague lamp post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/199/1*LkToVyZ2QTDLyWGoeQTK2Q.png" /></figure><p>So let’s begin now.</p><p>For our image we first need a dark background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*MvMAnYR-B7j7Vc71FLD_2w.png" /></figure><p>This creates a black background for our image.</p><p>For our light we can create a circle with the help of cv2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMZ2byOdFaloext3T9D-gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*jFY0IjWvBZc-M1ZnqvrukA.png" /></figure><p>Here we have made a circular section of pixels as white. So it is appearing as the white spot.</p><p>Now I would be adding a frame around the light source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*RQLceMZ6YJQqOpobiHMvQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*kEzCAGbci-fTGp3VGrJDQA.png" /></figure><p>Well not the best of light source but it works. Here i have added four straight segements to cover the light. The coordinates play a vital role here.</p><p>Now finally let’s add the pole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kh1SkS25sV4onbdKJw4mjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*P65tBDhJbnqwBoUQTiYC-A.png" /></figure><p>The key takeaway here is that we have created this image by just manipulating the numpy array. CV2 was just used for viewing the array not creating it.</p><p>This trick can be used for data augmentation too or preprocessing images too.</p><p>So now let’s move on to the next part.</p><h3>Cropping and swapping</h3><p>Here we will be cropping part of one image and replacing it to the part of the second image.</p><p>We all know the elon and doge memes that have been circulating.</p><p>So for cropping the image I would be placing doge in elon’s image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*pNcrRWZcvC8IyA4sMAfoXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-o7PbTnr8J7QgMzYEdRgfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*Y6YW41m1DuOeisMKyOewrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Hf2PrtwJrGt4276r1FJEw.png" /></figure><p>Cropping images just means slicing the numpy array. So here we sliced the doge’s image and changed the value of elon’s image to it. So it feels like we have cropped the image. But all we have done is sliced some part of the numpy array and replaced it.</p><p>So I guess this must be pretty clear.</p><h3>Concatenating images</h3><p>For the final part we will be stacking two images .</p><p>Here we will use two images of doge and cheems</p><p>For this we would be using the hstack. So the htstack takes two numpy arrays and joins them horizontally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*yB30vAK27DCRhXZo0HSqcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*GCOxPFw7A4-aLF1xfSqW_Q.png" /></figure><p>So here we stacked two numpy arrays horizontally.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43f0acbf3d42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Confusion Matrix and cyber security]]></title>
            <link>https://2503arjun.medium.com/confusion-matrix-and-cyber-security-4a1edab8c88b?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a1edab8c88b</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[confusion-matrix]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Fri, 04 Jun 2021 05:08:56 GMT</pubDate>
            <atom:updated>2021-06-04T05:08:56.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Confusion matrix is a fairly common term when it comes to machine learning. Today I would be trying to relate the importance of confusion matrix when considering the cyber crimes.</p><p>So confusion matrix is yet another classification metric that can be used to tell how good our model is performing. Yet it is more often used in various places which might not be using the confusion matrix.</p><p>This all gives us an idea that there is something more to confusion matrix than just being another classification metric.</p><p>So before we dive deep let’s first understand what a confusion matrix is.</p><h4>Confusion Matrix?</h4><p>It is a performance measurement for machine learning classification problem where output can be two or more classes. It is a table with 4 different combinations of predicted and actual values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*qBS7uOB7n7BAXFbRqkwnKQ.png" /></figure><p><strong>True Positive:</strong></p><p>Interpretation: You predicted positive and it’s true.</p><p><strong>True Negative:</strong></p><p>Interpretation: You predicted negative and it’s true.</p><p><strong>False Positive: (Type 1 Error)</strong></p><p>Interpretation: You predicted positive and it’s false.</p><p><strong>False Negative: (Type 2 Error)</strong></p><p>Interpretation: You predicted negative and it’s false.</p><p>So this would give an idea of what the four boxes in the confusion matrix are representing.</p><p>So what makes the confusion matrix so peculiar is the presence and distinction of type 1 and type 2 errors.</p><p>High accuracy is always the goal be it machine learning or any other field. But the question is does high accuracy always mean better results. Well in most cases the answer is yes but let me give you an example where we might have to go beyond the common notion that we can blindly go towards a higher accuracy.</p><p>Let’s say an anti virus company came with an AI based anti virus that detects all the suspecting files. This model is giving 97 percent accuracy. Let’s say the model is working on your PC and you are there working on the next big thing. You just created an executable script which is very crucial for you but the anti virus being an AI model gave a “FALSE POSITIVE” that your file is a virus.</p><p>But on the other hand let’s say that you downloaded a few music videos that might have contained some malicious package but your model was unable to detect it and gave a “FALSE NEGATIVE”.</p><p>So now you have a choice. What type of model would you prefer. The mere existence of a choice here means that just accuracy doesn’t suffice the need in some cases because in both these cases the accuracy remained the same.</p><p>So you might now have a gist of the importance of the two types of error in confusion matrix and what they mean.</p><p><strong>Cybercrime can be anything like:</strong></p><ul><li>Stealing of personal data</li><li>Identity stolen</li><li>For stealing organizational data</li><li>Steal bank card details.</li><li>Hack emails for gaining information.</li></ul><p>Trade off between type 1 and type 2 error is very critical in cyber security. Let’s take another example. Consider a face recognition system which is installed infront of the data warehouse which holds critical error. Consider that the manager comes and the recognition system is unable to recognize him. He tries to log in again and is allowed in.</p><p>This seems a pretty normal scenario. But let’s consider another condition. A new person comes and tries to log himself in. The recognition system makes and error and allows him in. Now this is very dangerous. An unauthorized person has made an entry. This could be very damaging to the whole company.</p><p>In both the cases there was an error made by the security system. But the tolerance for False Negative here is 0 although we can still bear False Positive.</p><p>This shows the critical nature that might vary from use case to use case where we want a tradeoff between the two types of error.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a1edab8c88b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Loading a machine learning model in docker]]></title>
            <link>https://2503arjun.medium.com/loading-a-machine-learning-model-in-docker-2d531db40712?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d531db40712</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Thu, 27 May 2021 02:21:58 GMT</pubDate>
            <atom:updated>2021-05-27T02:21:58.348Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*NjaxCnU8wdufRznDZ2q71w.png" /></figure><p>In today’s blog I would be doing a simple thing. I will create a docker container and run a machine learning model in it.</p><p>So machine learning models are quite memory consuming although the model and the dataset I have used are pretty small but real world applications can be much more memory extensive.</p><p>So I will be training the model in my local system and then move the saved model in docker container.</p><p>This has multiple benefits. We can use the container to create a new docker image which can be used to create multiple containers who are capable of predicting.</p><h3>The steps</h3><ol><li>I would be using the RHEL 8 system as by BaseOS. So firstly we need to download docker. For this we use</li></ol><blockquote>yum install docker</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*JW846Kp9qHzAAiFYWXP-Cw.png" /></figure><p>Docker is just like any other service which needs to be started or enabled. To start docker and check whether it is running or not we use</p><blockquote>systemctl start docker</blockquote><blockquote>systemctl status docker</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kd5F2c4xlOf-0j4Ebp3QEA.png" /></figure><p>2. Now since the services are up and running we can now create a docker container. For this I am using the centos:latest image.</p><p>The command to run the container is</p><p>docker run -dit &lt;container_name&gt; &lt;image_name&gt;:&lt;image_tag&gt; /bin/bash</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9zPLH2xjKZaiq88Zmu-sQ.png" /></figure><p>As you can see the container is up and running. To view the status of the container we can use</p><blockquote>docker ps</blockquote><ul><li>dit used in the above command tells the docker that we need a detached interactive terminal for our container.</li></ul><p>3. Now we have the bare minimum container requirement done. So now moving on to the python script to train the model. The dataset used here is a small artificial dataset which uses the experience to predict the salary of a person.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*cM70oJfwMGlBXKGYYUUAWQ.png" /></figure><p>It is very easy to see that this is a simple linear regression problem. In the below file you see I have read this dataset and used python’s ML library scikit learn to fit the dataset and save the model in a pickle file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*mdX8o12vpZlsQ3Xt9lCtUw.png" /></figure><p>4. We would now create a python script that is going to predict the salary of a person using his years of experience as input</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*JhoEmGW-F_C8l908YnYKbg.png" /></figure><p>5. Now all that is left is to copy this file in the docker container and set up the python environment. To copy file to the docker container we use</p><p>docker cp &lt;source_location&gt; &lt;container_name&gt;:&lt;destination&gt;</p><p>After transferring the file we can attach ourselves to the container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VU5cJJQRkQkrEVF2G9gww.png" /></figure><p>6. Now we need to install the python3 and scikit-learn libraries in our docker container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5a1PqwiKPjE3N1SKAMbvg.png" /></figure><p>7. Now finally we can run the python script and get the output as the salary when we get the number of years as the input from the user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZBZ6Oh062xVKl3Yuv1gkA.png" /></figure><p>This was a very simple task however we can build around this. For example we can create a kubernetes cluster of this container and then use a webserver to host it. However this is something to dwell upon some other day</p><p>Thanks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d531db40712" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB: Case Study with KPMG]]></title>
            <link>https://2503arjun.medium.com/mongodb-case-study-with-kpmg-63438985a629?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/63438985a629</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[case-study]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Tue, 11 May 2021 18:30:51 GMT</pubDate>
            <atom:updated>2021-05-11T18:30:51.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*bWOaHpMc76-Yhp3ANjji0A.png" /></figure><p>Databases are an integral and one of the most critical element of almost every business. Databases are divided into two categories:</p><ul><li>SQL database</li><li>NoSQL(Not Only SQL) database</li></ul><p>SQL databases have a predefined schema according to which the data is entered in database. A schema is simply a blueprint telling how many columns of data will be entered and attributes of each record entered. SQL database have been around since decades. But there has been a rise in popularity of NoSQL data.</p><h3>SQL Databases</h3><p>The idea behind relational relationships is that data is stored in tables, which are organized into columns, and each column stores one type of data with each instance table data in rows.</p><p>There are various products that work on SQL databases MySQL, Oracle, and Microsoft SQL Server database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEZAaQ-SLw5We40iajdexA.png" /></figure><h3>Growth of NoSQL</h3><p>NoSQL databases don’t have such structured schema.The Not Only SQL or NoSQL database is an approach that works towards managing data as well as database design which may come in handy for huge sets of distributed data.</p><p>This is actually a need in current scenario. With the advent of 21st century there is more and more need to handle unstructured data which is being generated by most of the companies around the world. This data is not structured. Hence analysis of this data using SQL is not possible. This is primarily the reason why NoSQL databases are gaining more and more popularity nowadays.</p><p>The issue with SQL is that there is a disconnect between the data and the interfaces that consume it. Tableless’s rise to mainstream popularity is partially due to its immense flexibility and lack of constraints.</p><p>There are various NoSQL products that exist in the market. The NoSQL databases differ in the type of architecture they have.</p><p>Today we will be discussing about one such NoSQL database known as MongoDB.</p><h3>MongoDB?</h3><p>MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas.</p><p>There are various benefits of using Mongodb. Although the choice of database depends on the use case we have to implement I would like to list a few features of mongodb that makes it a good choice for the companies:</p><ul><li><strong>Rich Object Model:</strong> MongoDB supports a rich and expressive object model. Objects can have properties and objects can be nested in one another (for multiple levels). This model is very “object-oriented” and can easily represent any object structure in your domain. You can also index the property of any object at any level of the hierarchy — this is brilliantly powerful!</li><li><strong>Secondary Indexes: </strong>Indexes speed up the queries significantly, but they also slow down writes. Secondary indexes are a first-class construct in MongoDB. This makes it easy to index any property of an object stored in MongoDB even if it is nested. This makes it really easy to query from the database based on these secondary indexes.</li><li><strong>Replication and high availability: </strong>MongoDB supports a “single master” model. This means you have a master node and a number of slave nodes. In case the master goes down, one of the slaves is elected as master. This process happens automatically but it usually takes time, before the 3.2 release, 10–40 seconds were taken but after the release of MongoDB 3.2 and later, failures are detected faster and a new leader elected in under 2–10 seconds.</li></ul><p>Now since we have the gist of the importance of database and an idea of the usage of MongoDB let’s see how KPMG is using Mongodb in it’s tech stack.</p><h3>The KPMG story</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*D0IK5Q334hYT5eR49-KVMA.png" /></figure><p>KPMG is one of the world’s largest professional services firms operating as independent businesses in 155 countries, with 174,000 staff. KPMG provides audit, tax and advisory services used by corporations, governments and not-for-profit organizations.</p><p>With a business this large it is very important to have an efficient database system which is robust to unstructured data.</p><p>There are various ways in which KPMG is utilizing the mongodb architecture.</p><h4>Data Lake</h4><p>All raw accounting data from the customers’ business systems, such as sales data, invoices, bank statements, cash transactions, expenses, payroll and so on, is ingested from Microsoft SQL Server into MongoDB. This data is then accessible to the CPAs to generate the customer’s KPIs. A unique capability they have developed for the customers is financial benchmarking. They can use the data in the MongoDB data lake to allow our customers to benchmark their financial performance against competitors operating in the same industries within a specified geographic region.</p><h4><strong>Metadata Management</strong></h4><p>Another unique feature of the accounting suite is the ability to customize reporting for each customer, based on specific criteria they want to track. For example, a restaurant chain will be interested in different metrics than a construction company. KPMG enable this customization by creating a unique schema for each customer which is inherited from a standard business application schema, and then written to MongoDB.</p><h4><strong>Logging Layer</strong></h4><p>KPMG also use MongoDB to store all the Loop application’s millions of clients requests each day. This enables them to build Tableau reports on top of the logs to troubleshoot production performance issues for each user session, and for each of the 220 regional KPMG sites spread across France.</p><p><strong>KPMG estimated that by selecting MongoDB for the accounting suite they have achieved at least a 50% faster time to market than using any other non-relational database.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63438985a629" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talking querying with AWS SQS]]></title>
            <link>https://2503arjun.medium.com/talking-querying-with-aws-sqs-efe3296a8da3?source=rss-2eb8b4a94e37------2</link>
            <guid isPermaLink="false">https://medium.com/p/efe3296a8da3</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-sqs]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[querying]]></category>
            <dc:creator><![CDATA[Arjun Chauhan]]></dc:creator>
            <pubDate>Sun, 14 Mar 2021 05:24:18 GMT</pubDate>
            <atom:updated>2021-03-14T05:24:18.452Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*pn5UWNAXW3EA5Utzml2qmw.png" /></figure><p>Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables the user to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available.</p><p>Amazon SQS allows us to store messages that are in transit from one computer to the other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*EzjOvj79QaEuDlKFdvNEgw.png" /></figure><p>One might wonder that why we would be using such a service.</p><p>For example, let’s say you have a service where people upload photos from their mobile devices. Once the photos are uploaded your service needs to do a bunch of processing of the photos, e.g. scaling them to different sizes, applying different filters, extracting metadata, etc.</p><p>One way to accomplish this would be to post a message to an SQS queue (or perhaps multiple messages to multiple queues, depending on how you architect it). The message describe work that needs to be performed on the newly uploaded image file. Once the message has been written to SQS, your application can return a success to the user because you know that you have the image file and you have scheduled the processing.</p><p>In the background, you can have servers reading messages from SQS and performing the work specified in the messages. If one of those servers dies another one will pick up the message and perform the work. SQS guarantees that a message will be delivered eventually so you can be confident that the work will eventually get done.</p><h3>Benefits</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*fwVTTUmBpMZ17XjtHOvB3A.png" /></figure><p>AWS manages all in progress operations and underlying infrastructure required to produce an extremely accessible and scalable message queuing service. With AWS SQS, there’s no direct value, no ought to acquire, install, and assemble messaging package, and no long build-out and maintenance of supporting infrastructure.</p><p>Use AWS SQS to transmit any volume of data, at any level of output, while not losing messages or requiring alternative services to be accessible. Amazon SQS helps you to decouple application parts in order that they run and fail severally, increasing the fault tolerance of the system.</p><p>You can use Amazon SQS to exchange sensitive data between applications using server-side secret writing (SSE) to inscribe every message body. The AWS SQS compass point integration with KMS permits you to centrally manage the keys that defend SQS messages together with keys that defend your alternative AWS resources.</p><p>AWS SQS leverages the AWS cloud to dynamically scale supported demand. Amazon SQS scales elastically together with your application. Therefore, you don’t have to worry regarding capability designing and pre-provisioning.</p><p>Let’s take a case study now.</p><h3>The Redbus Story</h3><p>Redbus is an Indian travel agency that specializes in bus travel throughout India by selling bus tickets throughout the country. Tickets are purchased through the company’s Website or through the Web services of its agents and partners.</p><p>The company also offers software, on a Software as a Service (SaaS) basis, which gives bus operators the option of handling their own ticketing and managing their own inventories.</p><p>The company previously ran its operations from a traditional data center by purchasing and renting its systems and infrastructure. In addition to the expense, several logistical problems evolved from this arrangement. The biggest problem was that the infrastructure could not effectively handle processing fluctuations, which had a negative impact on productivity. Additionally, the procurement of servers or upgrading the server configuration was an extremely time-consuming endeavor.</p><p>After testing the AWS solution on a small application for several months, the travel agency determined that it was very workable and convenient. Although redBus was quite enthusiastic about the on-demand instances and variety of instance types, several other features cemented the company’s decision to migrate completely to AWS.</p><h4>Benefits of AWS</h4><ul><li>Reduced costs by up to 40%</li><li>Reduced website latency by 4x</li><li>Able to instantly replicate test environments, which in turn reduces time to market</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efe3296a8da3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>