<?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 Amit Kumar on Medium]]></title>
        <description><![CDATA[Stories by Amit Kumar on Medium]]></description>
        <link>https://medium.com/@amit.kumar21326?source=rss-1b426093e358------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mCrcPkWoTvq8IKseXfxi1Q.png</url>
            <title>Stories by Amit Kumar on Medium</title>
            <link>https://medium.com/@amit.kumar21326?source=rss-1b426093e358------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:01:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amit.kumar21326/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[Empowering Content Creators: How Seedr Transformed My Workflow]]></title>
            <link>https://medium.com/@amit.kumar21326/empowering-content-creators-how-seedr-transformed-my-workflow-a3ee3ca3dfc1?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3ee3ca3dfc1</guid>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[productivity-tools]]></category>
            <category><![CDATA[downloads-and-streaming]]></category>
            <category><![CDATA[torrent]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Fri, 26 May 2023 04:23:58 GMT</pubDate>
            <atom:updated>2023-05-26T04:26:55.837Z</atom:updated>
            <content:encoded><![CDATA[<p>As a content creator, my journey has been marked by various challenges, including limited storage capacity and slow download speeds. However, my productivity and efficiency soared when I discovered <a href="https://www.seedr.cc/">Seedr</a>. This innovative cloud-based platform revolutionized the way I manage and access my files, ultimately transforming my content creation experience for the better. In this article, I will share how Seedr helped me overcome these obstacles, enabling me to focus on what matters most: crafting engaging and high-quality content.</p><p><strong>Streamlined File Management</strong>: <a href="https://www.seedr.cc/">Seedr’s</a> seamless file management system has been a game-changer for me. With its intuitive user interface, I can effortlessly organize my files and folders, ensuring a clutter-free workspace. No longer do I waste precious time searching for specific documents or dealing with the frustration of a disorganized file structure. <a href="https://www.seedr.cc/">Seedr’s</a> user-friendly approach has simplified my workflow, allowing me to dedicate more time to writing engaging blog posts.</p><p><strong>Ample Storage Space</strong>: One of the most significant limitations I faced as a blogger was the lack of storage space. With a multitude of images, videos, and other media files, my local storage would often reach its limits, hindering my creative process. <a href="https://www.seedr.cc/">Seedr’s</a> generous storage allocation, coupled with its ability to handle large file sizes, has eliminated this problem. The platform’s scalable storage options, such as their premium plans, have given me the freedom to store and access all my essential files without the fear of running out of space.</p><p><strong>Lightning-Fast Downloads</strong>: Gone are the days of waiting for hours to download large media files. <a href="https://www.seedr.cc/">Seedr’s</a> lightning-fast download speeds have been a game-changer for my blogging workflow. Whether I’m downloading stock images, high-definition videos, or other resources, <a href="https://www.seedr.cc/">Seedr’s</a> robust infrastructure ensures that my files are readily available in no time. This boost in download speed has allowed me to work more efficiently, enabling me to meet strict deadlines and deliver content promptly.</p><p><strong>Accessibility on Any Device</strong>: Being a blogger constantly on the move, having access to my files from any device is crucial. <a href="https://www.seedr.cc/">Seedr’s</a> cross-platform compatibility has made this a reality for me. Whether I’m working on my laptop, tablet, or smartphone, <a href="https://www.seedr.cc/">Seedr’s</a> web-based interface and mobile app seamlessly synchronize my files, ensuring I have access to them whenever and wherever I need them. This level of accessibility has transformed my productivity, as I no longer need to be tied to a single device to continue working on my blog.</p><p><strong>Conclusion:</strong> In my journey as a content creator, <a href="https://www.seedr.cc/">Seedr</a> has proven to be an invaluable tool, helping me overcome the obstacles that once hindered my productivity and creativity. With its streamlined file management, ample storage space, lightning-fast downloads, and cross-platform accessibility, Seedr has truly revolutionized the way I approach my work. Seedr has become an indispensable asset for any content creator seeking to enhance their workflow and focus on what truly matters: crafting remarkable and engaging content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3ee3ca3dfc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiProcessings, Threads, and Async in Python]]></title>
            <link>https://medium.com/@amit.kumar21326/multiprocessings-threads-and-async-in-python-b3a1b3bba4b9?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3a1b3bba4b9</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[multitasking]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Tue, 18 Apr 2023 11:47:18 GMT</pubDate>
            <atom:updated>2023-04-18T11:51:49.065Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, where technology is advancing every day, it is crucial to keep up with the latest advancements to stay ahead of the competition. In the field of programming, the use of parallel processing, threads, and async has become a game-changer. Python, one of the most popular programming languages, offers great support for these features.</p><p>In this article, we will discuss the use cases of Multiprocessing, Threads, and Async in Python programming language, and how they can be used to write efficient and faster programs.</p><p><strong>Multiprocessing</strong></p><p>Multiprocessing is a technique used to run multiple processes simultaneously. In Python, the multiprocessing module provides support for multiprocessing. With multiprocessing, each process has its memory space, which means that there is no interference between the processes. This technique can be used to make efficient use of multi-core CPUs.</p><p>Multiprocessing is used when we want to perform tasks that are CPU intensive. For example, when we need to perform a large number of calculations or when we need to process large datasets. In these cases, we can divide the workload into multiple processes, and each process can work on a different subset of the data.</p><pre>import multiprocessing<br><br>def my_function():<br>    # do some work here<br><br># create a new process and start it<br>my_process = multiprocessing.Process(target=my_function)<br>my_process.start()</pre><p><strong>Threads</strong></p><p>Threads are another way of achieving parallelism in Python. Threads are similar to processes, but they share the same memory space. This means that threads can communicate with each other and share data between them.</p><p>Threads are used when we want to perform tasks that are I/O intensive. For example, when we need to read or write data from a file or a database, we can use threads to do this in parallel. This technique can improve the overall performance of the program and make it more efficient.</p><pre>import threading<br><br>def my_function():<br>    # do some work here<br><br># create a new thread and start it<br>my_thread = threading.Thread(target=my_function)<br>my_thread.start()</pre><p><strong>Async</strong></p><p>Async is a technique used to write asynchronous code in Python. Async allows us to write non-blocking code, which means that we can perform other tasks while waiting for a certain operation to complete.</p><p>Async is used when we need to perform tasks that involve I/O operations. For example, when we need to make HTTP requests or when we need to communicate with a remote server. Using Async, we can perform these tasks without blocking the main thread, which can improve the performance of the program.</p><pre>import asyncio<br><br>async def my_function():<br>    # do some work here<br><br># create an event loop and run the async function<br>loop = asyncio.get_event_loop()<br>loop.run_until_complete(my_function())</pre><p><strong>When to use Multiprocessing, Threads, and Async</strong></p><p>Choosing the right technique depends on the type of task we want to perform. As we have discussed earlier, Multiprocessing is used for CPU intensive tasks, Threads are used for I/O intensive tasks, and Async is used for tasks that involve I/O operations.</p><p>For example, if we want to process a large dataset and perform a large number of calculations on it, we can use Multiprocessing to divide the workload into multiple processes, and each process can work on a different subset of the data.</p><p>If we want to read or write data from a file or a database, we can use Threads to do this in parallel. This technique can improve the overall performance of the program and make it more efficient.</p><p>If we need to make HTTP requests or communicate with a remote server, we can use Async to perform these tasks without blocking the main thread, which can improve the performance of the program.</p><p><strong>Conclusion</strong></p><p>In conclusion, MultiProcessings, Threads, and Async are powerful techniques that can be used to write efficient and faster programs in Python. Choosing the right technique depends on the type of task we want to perform. Multiprocessing is used for CPU intensive tasks, Threads are used for I/O intensive tasks, and Async is used for tasks that involve I/O operations.</p><p>A Small caveat with using threads in Python is the Global Interpreter Lock (GIL). The GIL is a mechanism that only allows one thread to execute Python bytecode at a time, even on multi-core machines. This means that although you can have multiple threads running simultaneously in a Python program, they can’t truly execute in parallel because only one thread can hold the GIL at any given time.</p><p>As a result, threads in Python are more useful for I/O-bound tasks (e.g. waiting for network requests or disk I/O) rather than CPU-bound tasks (e.g. complex calculations). When a thread is blocked on I/O, it releases the GIL, allowing other threads to execute Python bytecode. This can lead to significant performance improvements when compared to synchronous I/O, where the entire program would be blocked until the I/O operation completed.</p><p>To work around the limitations of the GIL, developers can use other approaches to concurrency in Python such as async and multiprocessing. Async allows for non-blocking I/O without the need for threads, while multiprocessing allows for true parallelism by running multiple Python interpreters in separate processes, each with its own GIL. However, these approaches may have their own drawbacks and trade-offs, depending on the specific use case.</p><p>By using these techniques, we can make the most out of our resources and write programs that are optimized for performance. So, next time you write a Python program, consider using these techniques to make it more efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3a1b3bba4b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Writing FastAPI and MongoDB code]]></title>
            <link>https://medium.com/@amit.kumar21326/best-practices-for-writing-fastapi-and-mongodb-code-bb4ad1e5c8ad?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb4ad1e5c8ad</guid>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Tue, 18 Apr 2023 10:38:20 GMT</pubDate>
            <atom:updated>2023-04-18T10:40:31.243Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Write Performant FastAPI and MongoDB Code</h3><ol><li>Introduction</li><li>Code Practices for Maintainability<br> a. Separation of Concerns<br> b. Consistency in Code Style<br> c. Code Reusability</li><li>Code Practices for Scalability and Performance <br>a. Indexing in MongoDB<br> b. Caching in FastAPI<br> c. Handling Large Datasets</li><li>Testing and Documentation Best Practices<br> a. Unit Testing<br> b. Integration Testing<br> c. API Documentation</li><li>Conclusion</li></ol><h4>Introduction</h4><p>FastAPI and MongoDB are two powerful tools for building scalable and performant applications. However, to ensure that your application runs smoothly and efficiently, it is essential to follow certain code practices. In this guide, we will explore the best code practices for maintaining FastAPI and MongoDB applications.</p><h4><strong>Code Practices for Maintainability</strong></h4><p>Maintainability is crucial for the long-term success of an application. Following the below code practices can help improve the maintainability of your FastAPI and MongoDB code.</p><p><strong>Separation of Concerns</strong></p><p>Separation of concerns is a software design principle that promotes dividing software into distinct sections. This makes it easier to manage and maintain code as each section is responsible for a specific task. In FastAPI and MongoDB applications, it is essential to separate the logic related to data access from the business logic. This makes it easier to modify and maintain the application in the future.</p><p><strong>Consistency in Code Style</strong></p><p>Consistency in code style is essential for ensuring that your code is easy to read and maintain. Following a consistent code style throughout the application makes it easier for developers to understand the codebase. Using a linter and adhering to a style guide can help ensure consistency in code style.</p><p><strong>Code Reusability</strong></p><p>Code reusability is the practice of writing code that can be reused in other parts of the application. This helps reduce code duplication and makes it easier to maintain the application. In FastAPI and MongoDB applications, it is important to identify code that can be reused and create reusable components that can be used across the application.</p><h4><strong>Following Code Practices for Scalability and Performance</strong></h4><p>Code Practices for Scalability and Performance Scalability and performance are critical for the success of any application.</p><p><strong>Indexing in MongoDB</strong></p><p>Indexing is an essential practice for improving query performance in MongoDB. Indexes allow MongoDB to quickly locate and retrieve data, resulting in faster query response times. When designing your MongoDB database schema, consider the types of queries that will be executed frequently and create indexes accordingly.</p><p><strong>Caching in FastAPI</strong></p><p>Caching is a technique that can significantly improve the performance of a FastAPI application. By caching frequently accessed data, you can reduce the number of requests made to the database, resulting in faster response times. FastAPI provides built-in support for caching through tools such as caching middlewares and libraries like FastAPI-Caching.</p><p><strong>Handling Large Datasets</strong></p><p>Handling large datasets can be a challenge in FastAPI and MongoDB applications. When working with large datasets, consider using pagination to limit the amount of data returned in a single query. Additionally, you can use techniques such as lazy loading and data filtering to improve the performance of your application.</p><h4><strong>Testing and Documentation</strong></h4><p>Best Practices Testing and documentation are critical components of building maintainable and scalable applications.</p><p><strong>Unit Testing</strong></p><p>Unit testing is the practice of testing individual units of code to ensure that they work as expected. In FastAPI and MongoDB applications, it is essential to write unit tests for each function and method in the codebase. This helps identify and fix bugs early in the development process, resulting in a more stable and maintainable application.</p><p><strong>Integration Testing</strong></p><p>Integration testing is the practice of testing the interaction between different components of an application. In FastAPI and MongoDB applications, integration testing can help ensure that the different components of the application work together as expected. Integration testing can be performed using tools such as PyTest and FastAPI-TestClient.</p><p><strong>API Documentation</strong></p><p>API documentation is essential for building maintainable and scalable FastAPI applications. Well-documented APIs make it easier for other developers to understand the functionality of the application and how to use it. FastAPI provides built-in support for generating documentation using tools such as Swagger UI and ReDoc.</p><h4><strong>Conclusion</strong></h4><p>Maintaining FastAPI and MongoDB applications requires following specific code practices. By separating concerns, ensuring consistency in code style, and promoting code reusability, you can improve the maintainability of your code. Additionally, indexing in MongoDB, caching in FastAPI, and handling large datasets can help improve scalability and performance. Finally, unit testing, integration testing, and API documentation are essential for building maintainable and scalable applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb4ad1e5c8ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boost Your Python Skills: Essential Tricks for Efficient Programming]]></title>
            <link>https://medium.com/@amit.kumar21326/boost-your-python-skills-essential-tricks-for-efficient-programming-651fa2fe2ae8?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/651fa2fe2ae8</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[tricks]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Tue, 18 Apr 2023 10:15:34 GMT</pubDate>
            <atom:updated>2023-04-18T15:39:36.114Z</atom:updated>
            <content:encoded><![CDATA[<p>Python is a versatile programming language that has gained widespread popularity in recent years due to its ease of use and flexibility. With its large and active community, there are many useful tricks and techniques that can help improve your Python coding skills. In this article, we will cover some of the best Python tricks that can help you become a more efficient and productive Python programmer.</p><ul><li><strong>List Comprehension</strong></li></ul><p>List comprehension is a concise way to create lists in Python. It allows you to create a list with a single line of code, instead of using loops. This can save you time and improve the readability of your code.</p><p>For example, the following codecreates a list of squares of the numbers from 0 to 9:</p><pre>squares = [x**2 for x in range(10)]</pre><ul><li><strong>Lambda Functions</strong></li></ul><p>Lambda functions are anonymous functions that can be defined in a single line of code. They are useful when you need a small function for a specific purpose and don’t want to define a separate function. This can make your code more concise and easier to read.</p><p>For example, the following code defines a lambda function that returns the square of a number:</p><pre>square = lambda x: x**2</pre><ul><li><strong>Unpacking Lists and Tuples</strong></li></ul><p>You can unpack a list or tuple into individual variables using the * operator. This can save you time and improve the readability of your code.</p><p>For example, the following code unpacks a list into individual variables:</p><pre>a, b, *c = [1, 2, 3, 4, 5]</pre><ul><li><strong>Using the zip Function</strong></li></ul><p>The zip function can be used to iterate over two or more lists in parallel. This is useful when you need to combine data from multiple sources.</p><p>For example, the following code iterates over two lists and prints their values together:</p><pre>list1 = [1, 2, 3]<br>list2 = [‘a’, ‘b’, ‘c’]<br>for a, b in zip(list1, list2):<br>  print(a, b)</pre><ul><li><strong>Context Managers</strong></li></ul><p>Context managers allow you to manage resources such as files and network connections. They ensure that resources are properly allocated and released, even if an exception occurs. This can help you write more robust and error-resistant code.</p><p>For example, the following code uses a context manager to open a file and read its contents:</p><pre>with open(‘file.txt’, ‘r’) as f:<br>  contents = f.read()</pre><ul><li><strong>Ternary Operator</strong></li></ul><p>The ternary operator is a shorthand way of writing an if-else statement in a single line of code. It can make your code more concise and readable.</p><p>For example, the following code uses the ternary operator to assign a value to a variable based on a condition:</p><pre>result = ‘pass’ if score &gt;= 60 else ‘fail’</pre><ul><li><strong>Enumerate Function</strong></li></ul><p>The enumerate function can be used to add a counter to an iterable. This is useful when you need to keep track of the index or position of items in a list or tuple.</p><p>For example, the following code uses the enumerate function to iterate over a list and print its values and indices:</p><pre>my_list = [‘a’, ‘b’, ‘c’]<br>for i, item in enumerate(my_list):<br>  print(i, item)</pre><ul><li><strong>The any() and all() Functions</strong></li></ul><p>The any() function returns True if at least one element of an iterable is True, while the all() function returns True if all elements of an iterable are True. These functions can be useful when you need to check if a list or other iterable contains any True values or all True values.</p><p>For example, the following code uses the any() function to check if a list contains any odd numbers:</p><pre>my_list = [1, 2, 3, 4, 5]<br>if any(num % 2 == 1 for num in my_list):<br>  print(‘The list contains at least one odd number’)</pre><ul><li><strong>Using Generators</strong></li></ul><p>Generators are functions that use the yield keyword to return a sequence of values one at a time, instead of returning a list or other sequence all at once. This can be useful when working with large amounts of data or when you only need to process part of a sequence.</p><p>For example, the following code uses a generator expression to generate the squares of the numbers from 1 to 10:</p><pre>squares = (x**2 for x in range(1, 11))<br>for square in squares:<br>  print(square)</pre><ul><li><strong>Decorators</strong></li></ul><p>Decorators are functions that modify the behavior of other functions. They can be used to add functionality to existing functions without modifying their code directly, or to wrap a function with additional functionality.</p><p>For example, the following code defines a decorator that logs the time it takes to run a function:</p><pre>import time<br><br>def timer(func):<br>  def wrapper(*args, **kwargs): <br>    start_time = time.time() <br>    result = func(*args, **kwargs)<br>    end_time = time.time() <br>    print(f&#39;Time taken: {end_time - start_time:.2f} seconds&#39;)<br>  return result<br>return wrapper<br><br><br>@timer<br>def slow_function():<br>  time.sleep(2) <br>  print(&#39;Function completed&#39;)<br><br>slow_function()</pre><p>These are just a few of the many Python tricks that can help you become a more efficient and productive Python programmer. By incorporating these techniques into your code, you can write more concise, readable, and robust Python programs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=651fa2fe2ae8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Kafka VS Apache Kinesis]]></title>
            <link>https://faun.pub/apache-kafka-vs-apache-kinesis-57a3d585ef78?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/57a3d585ef78</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[kinesis]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 13:44:16 GMT</pubDate>
            <atom:updated>2019-07-21T11:21:32.740Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache Kafka VS AWS Kinesis</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*URe8tSLK7tvDWD1Woi27Bw.png" /></figure><p>Recently, I got the opportunity to work on both the Streaming Services. Kafka vs Kinesis often comes up. And believe me, both are Awesome but it depends on your use case and needs.</p><p>I have heard people saying that kinesis is just a rebranding of Apache’s Kafka. And I don’t agree with them totally. I’ll try my best to explain the core concepts of both the bigshots.</p><p>Let’s start with Kinesis</p><p>Like many of the offerings from Amazon Web Services, Amazon Kinesis software is modeled after an existing Open Source system. In this case, Kinesis is modeled after Apache Kafka.</p><p>Kinesis is known to be incredibly fast, reliable and easy to operate. Similar to Kafka, there are plenty of language-specific clients available including Java, Scala, Ruby, Javascript (Node), etc.</p><p>Amazon Kinesis has a built-in cross replication while Kafka requires configuration to be performed on your own. Cross-replication is the idea of syncing data across logical or physical data centers. Cross-replication is not mandatory, and you should consider doing so only if you need it.</p><p>Engineers sold on the value proposition of Kafka and Software-as-a-Service or perhaps more specifically Platform-as-a-Service have options besides Kinesis or Amazon Web Services. Keep an eye on <a href="http://confluent.io./">http://confluent.io.</a></p><h3>Apache Kafka</h3><p>Apache Kafka is an open-source stream-processing software platform developed by Linkedin, donated to Apache Software Foundation, and written in Scala and Java. APIs allow producers to publish data streams to topics. A topic is a partitioned log of records with each partition being ordered and immutable. Consumers can subscribe to topics. Kafka can run on a cluster of brokers with partitions split across cluster nodes.</p><p>Kafka has five core APIs:</p><ul><li>The Producer API allows applications to send streams of data to topics in the Kafka cluster.</li><li>The Consumer API allows applications to read streams of data from topics in the Kafka cluster.</li><li>The Streams API allows transforming streams of data from input topics to output topics.</li><li>The Connect API allows implementing connectors that continually pull from some source system or application into Kafka or push from Kafka into some sink system or application.</li><li>The AdminClient API allows managing and inspecting topics, brokers, and other Kafka objects.</li></ul><p>Kafka has the following feature for real-time streams of data collection and big data real-time analytics:</p><ul><li>Performance: Works with the huge volume of real-time data streams. Handles high throughput for both publishing and subscribing</li><li>Scalability: Highly scales distributed systems with no downtime in all four dimensions: producers, processors, consumers, and connectors</li><li>Fault tolerance: Handles failures with the masters and databases with zero downtime and zero data loss</li><li>Data Transformation: Offers provisions for deriving new data streams using the data streams from producers</li><li>Durability: Uses Distributed commit logs to support messages persisting on disk</li><li>Replication: Replicates the messages across the clusters to support multiple subscribers</li></ul><p>As a result, Kafka aims to be scalable, durable, fault-tolerant and distributed. However, Kafka requires some human support to install and manage the clusters. Also, the extra effort by the user to configure and scale according to requirements such as high availability, durability, and recovery.</p><h3>AWS Kinesis</h3><p>Amazon Kinesis has four capabilities: Kinesis Video Streams, Kinesis Data Streams, Kinesis Data Firehose, and Kinesis Data Analytics. The Kinesis Data Streams can collect and process large streams of data records in real time as same as Apache Kafka. AWS Kinesis offers key capabilities to cost-effectively process streaming data at any scale, along with the flexibility to choose the tools that best suit the requirements of your application. It enables you to process and analyze data as it arrives and responds instantly instead of having to wait until all your data is collected before the processing can begin. Let’s focus on Kinesis Data Streams(KDS).</p><p>The high-level architecture on Kinesis Data Streams:</p><ul><li>The producers put records (data ingestion) into KDS. AWS provides Kinesis Producer Library (KPL) to simplify producer application development and to achieve high write throughput to a Kinesis data stream.</li><li>A Kinesis data Stream a set of shards. Each shard has a sequence of data records. Data records are composed of a sequence number, a partition key, and a data blob (up to 1 MB), which is an immutable sequence of bytes.</li><li>The consumers get records from Kinesis Data Streams and process them. You can build your applications using either Kinesis Data Analytics, Kinesis API or Kinesis Client Library (KCL).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BsoBy472FDo9APSv.png" /><figcaption>source: Google Images</figcaption></figure><p>Kinesis Data Streams has the following benefits:</p><ul><li>Fully managed: Kinesis is fully managed and runs your streaming applications without requiring you to manage any infrastructure</li><li>Scalability: Handle any amount of streaming data and process data from hundreds of thousands of sources with very low latencies</li><li>Durability: Kinesis Data Streams application can start consuming the data from the stream almost immediately after the data is added.</li><li>Elasticity: Scale the stream up or down, so the data records never lose before they expire</li><li>Fault tolerance: The Kinesis Client Library enables fault-tolerant consumption of data from streams and provides scaling support for Kinesis Data Streams applications</li><li>Security: Data can be secured at-rest by using server-side encryption and AWS KMS master keys on sensitive data within Kinesis Data Streams. Access data privately via your Amazon Virtual Private Cloud (VPC)</li></ul><p>As a result, Kinesis Data Streams is massively scalable and durable, allowing rapid and continuous data intake and aggregation; however, there is a cost for a fully managed service. KDS has no upfront cost, and you only pay for the resources you use (e.g., $0.015 per Shard Hour.) Please check Amazon for the latest Kinesis Data Streams <a href="https://aws.amazon.com/kinesis/data-streams/pricing/">pricing</a>.</p><h3>When to use Kafka or Kinesis?</h3><p>Kafka or Kinesis are often chosen as an integration system in enterprise environments similar to traditional message brokering systems such as ActiveMQ or RabbitMQ. Integration between systems is assisted by Kafka clients in a variety of languages including Java, Scala, Ruby, Python, Go, Rust, Node.js, etc.</p><p>Other use cases include website activity tracking for a range of use cases including real-time processing or loading into Hadoop or analytic data warehousing systems for offline processing and reporting.</p><p>An interesting aspect of Kafka and Kinesis lately is the use in stream processing. More and more applications and enterprises are building architectures which include processing pipelines consisting of multiple stages. For example, a multi-stage design might include raw input data consumed from Kafka topics in stage 1. In stage 2, data is consumed and then aggregated, enriched, or otherwise transformed. Then, in stage 3, the data is published to new topics for further consumption or follow-up processing during a later stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*8vIg5E6FVupvtYfhIdnn3w.png" /><figcaption>Throughput Comparison kinesis vs Kafka (Single to Multiple Producer)</figcaption></figure><h3>Conclusion</h3><p>Both Apache Kafka and AWS Kinesis Data Streams are good choices for real-time data streaming platforms. If you need to keep messages for more than 7 days with no limitation on message size per blob, Apache Kafka should be your choice. However, Apache Kafka requires extra effort to set up, manage, and support. If your organization lacks Apache Kafka experts and/or human support, then choosing a fully-managed AWS Kinesis service will let you focus on the development. AWS Kinesis is catching up in terms of overall performance regarding throughput and events processing.</p><p>Comments would be Appreciated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>💬<strong>.</strong></p><p><strong>To join our community Slack </strong>🗣️ <strong>and read our weekly Faun topics </strong>🗞️,<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oSdFkACJxs5iy1oR" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57a3d585ef78" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/apache-kafka-vs-apache-kinesis-57a3d585ef78">Apache Kafka VS Apache Kinesis</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Docker Images to ECS]]></title>
            <link>https://faun.pub/deploying-docker-images-to-ecs-b43058dc0456?source=rss-1b426093e358------2</link>
            <guid isPermaLink="false">https://medium.com/p/b43058dc0456</guid>
            <category><![CDATA[aws-ecs]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Amit Kumar]]></dc:creator>
            <pubDate>Wed, 13 Feb 2019 11:02:08 GMT</pubDate>
            <atom:updated>2019-07-19T15:38:30.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUQjFpGa54sqFAcPSjeT9A.jpeg" /></figure><p>You, like me, may have heard of Docker before. You may have co-workers or developer friends who rave about it, who “dockerize” everything they can, and who are at an utter loss for words when it comes to explaining Docker, and all its glory, in terms that are understandable to the average person. Today, I will attempt to demystify Docker and ECS for you.</p><h4>What is Docker?</h4><p>The Docker website itself simply describes Docker as:</p><blockquote>“the world’s leading software containerization platform” — Docker, Docker Overview</blockquote><p>That really clears it up, right? Umm…yeah, not really. A much better description of Docker is found on OpenSource.com.</p><blockquote><a href="https://github.com/docker/docker">Docker</a> is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. — OpenSource.com, What is Docker?</blockquote><p>What Docker really does is separate the application code from infrastructure requirements and needs. It does this by running each application in an isolated environment called a ‘container.’ This means developers can concentrate on the actual code to run in the Docker container without worrying about the system it will ultimately run on, and DevOps can focus on ensuring the right programs are installed in the Docker container and reduce the number of systems needed and complexity of maintaining said systems after deployment.</p><h4><strong>What is ECS?</strong></h4><p><a href="https://aws.amazon.com/ecs/">Amazon Elastic Container Service (ECS)</a> is a managed service for running containers on AWS, designed to make it easy to run applications in the cloud without worrying about configuring the environment for your code to run in. Using ECS, you can easily deploy containers to host a simple website or run complex distributed microservices using thousands of containers.</p><p>Getting started with ECS isn’t too difficult. To fully understand how it works and how you can use it, it helps to understand the basic building blocks of ECS and how they fit together!</p><h3>Now, let’s answer the question “How we are going to that?”.</h3><p><strong>Prerequisites</strong></p><p>1.AwsCli Knowledge</p><p>2.Basics of AWS(EC2, Vpc, Security groups, IAM)</p><p>3.Dockerizing Stuff(At least creating Images)</p><h4>Here We Go !!</h4><h4>Step 1: Open AWS Console and open Service “ECR” and click on create Repository.</h4><h4>ECR</h4><blockquote>Amazon Elastic Container Registry (ECR) is a fully-managed <a href="https://aws.amazon.com/docker/">Docker</a> container registry that makes it easy for developers to store, manage, and deploy Docker container images. Amazon ECR is integrated with <a href="https://aws.amazon.com/ecs/">Amazon Elastic Container Service (ECS)</a>, simplifying your development to production workflow. Amazon ECR eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure. Amazon ECR hosts your images in a highly available and scalable architecture, allowing you to reliably deploy containers for your applications. Integration with AWS Identity and Access Management (IAM) provides resource-level control of each repository. With Amazon ECR, there are no upfront fees or commitments. You pay only for the amount of data you store in your repositories and data transferred to the Internet.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hEtN3CuuMqIl7Oo_yOm-6g.png" /></figure><p>Create your Repository, mine is “node-twitter-stream”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0yLKEULpEaE5uQRoyb9X-g.png" /></figure><p>ALL Set, Repository is published and all we have to do is to push our docker image to our empty Repository.</p><h4>Step2: Pushing Docker Image to the ECR Repository from our local machine.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Hz-6mUnhdCojXq1xdHWZsg.png" /><figcaption>Push Commands for our Image</figcaption></figure><p>Open Terminal and login to AwsCli and Start Entering these commands.</p><pre>aws ecr get-login --no-include-email --region us-east-1</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*QUaBzufJ0Ig1W1TqyS3SQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*CpLE5BbVWQaswYQZzbHsdA.png" /></figure><pre><br>docker build -t node-twitter-stream .</pre><p>Output:</p><blockquote>Tagging Done {m/node-twitter-stream:latest}</blockquote><pre>docker push 001082169132.dkr.ecr.us-east-1.amazonaws.com/node-twitter-stream:latest</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*xJ4fC8rHryNQhC8hC4rPTg.png" /></figure><p>Now we have our image to Aws platform.</p><h4>Step3: Creating an ECS Cluster</h4><blockquote>An Amazon ECS cluster is a logical grouping of tasks or services. If you are running tasks or services that use the EC2 launch type, a cluster is also a grouping of container instances. When you first use Amazon ECS, a default cluster is created for you, but you can create multiple clusters in an account to keep your resources separate.</blockquote><p>Configure your Cluster as per your need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pYFCIZzSqlOpwqlMId7Kdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePwCw5Xn1Q_pYx_JnTpMxQ.png" /></figure><p>So, every time we create an ECS cluster, a cloud formation stack is launched on the other side which is managed by AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nfu03hSykVMaFPcwDlhrYw.png" /></figure><p>Once the cluster is established, we can define our Tasks.</p><h4>Step4: Creating Task Definition for ECS Cluster(Container)</h4><blockquote>A task definition is required to run Docker containers in Amazon ECS. Some of the parameters you can specify in a task definition include:</blockquote><blockquote>The Docker image to use with each container in your task</blockquote><blockquote>How much CPU and memory to use with each task or each container within a task</blockquote><blockquote>The launch type to use, which determines the infrastructure on which your tasks are hosted</blockquote><blockquote>The Docker networking mode to use for the containers in your task</blockquote><blockquote>The logging configuration to use for your tasks</blockquote><blockquote>Whether the task should continue to run if the container finishes or fails</blockquote><blockquote>The command the container should run when it is started</blockquote><blockquote>Any data volumes that should be used with the containers in the task</blockquote><blockquote>The IAM role that your tasks should use</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bJJsUTESLdQthF80wxWYSA.png" /><figcaption>click on “Create new task Definition”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbQ6aQs7PUiOBA4SczQkbg.png" /><figcaption>Configure Task Definition</figcaption></figure><p>Add Container will create a container for your Docker image which is already pushed into ECR Repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyknbej_vmlkn9Ua7_TShg.png" /></figure><p>Specify Container name and Image URI.</p><p>Memory <strong>Soft memory limit</strong> feature is designed for CPU bound applications where you want to reserve a small minimum of <strong>memory</strong> (the <strong>soft limit</strong>) but allow occasional bursts up to the hard <strong>limit.</strong></p><p>Port Mappings:</p><pre>dockerimage exposed port : conatiner exposed port</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RisjS0NDvg49thWoIFbLJw.png" /></figure><p>I have skipped these parameters as I have already mentioned all in my docker file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgpUJp1KfRaUC063rnrAUg.png" /></figure><p>Hit Create !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uq3gcM0ZcIIFQ_X9eHkCew.png" /></figure><p>Tadaaa !! Now we have our container running on the ec2 machine(Here “Container Instance”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z15UtddAtYyF3woaIlUV0w.png" /></figure><p>Use Public DNS(IPv4) to access our web app which is running in ECS Cluster.</p><p>Hopefully you, at the very least, learned a tiny something. All comments are very welcome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>💬<strong>.</strong></p><p><strong>To join our community Slack </strong>🗣️ <strong>and read our weekly Faun topics </strong>🗞️,<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oSdFkACJxs5iy1oR" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b43058dc0456" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/deploying-docker-images-to-ecs-b43058dc0456">Deploying Docker Images to ECS</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>