<?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 shoeb sayyed on Medium]]></title>
        <description><![CDATA[Stories by shoeb sayyed on Medium]]></description>
        <link>https://medium.com/@shoebsd31?source=rss-90d8255c3ba3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6uXi9Jhnbmqq4ZqpQTkEjQ.png</url>
            <title>Stories by shoeb sayyed on Medium</title>
            <link>https://medium.com/@shoebsd31?source=rss-90d8255c3ba3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:48:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shoebsd31/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[Exploring Database Sharding: Vertical vs. Horizontal Sharding and Pros and Cons of Each Approach]]></title>
            <link>https://medium.com/@shoebsd31/exploring-database-sharding-vertical-vs-horizontal-sharding-and-pros-and-cons-of-each-approach-3f7a7c6d4f42?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f7a7c6d4f42</guid>
            <category><![CDATA[database-sharding]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[sharding]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Sat, 15 Apr 2023 04:02:50 GMT</pubDate>
            <atom:updated>2023-04-15T04:02:50.813Z</atom:updated>
            <content:encoded><![CDATA[<p>Database sharding is a technique used in distributed database systems to horizontally partition data across multiple servers. It is used to scale out a database system by breaking it up into smaller, more manageable pieces, allowing the system to handle larger amounts of data and traffic.</p><p>There are two types of database sharding: vertical sharding and horizontal sharding. In this article, we will discuss each of these types in detail, along with their pros and cons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fwqe9iyr8uqHaehyzFLQ1A.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/alexey_hulsov-388655/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2829962">Alexey Hulsov</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2829962">Pixabay</a></figcaption></figure><h4>Vertical Sharding</h4><p>Vertical sharding is a database sharding technique that involves dividing a table into vertical partitions based on the columns or attributes of a table. Each shard contains a subset of the columns or attributes of the table. This approach is typically used when the data in a table is logically separable into distinct subsets.</p><p>For example, consider a customer database that stores information about customers and their transactions. In a vertically sharded database, the customer information might be stored in one shard, while the transaction information might be stored in another shard. This separation can improve query performance and reduce write contention, as queries and writes can be directed to specific shards rather than being spread across the entire table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQ1x-NHaTCDDjedix4YaCA.png" /><figcaption>vertical shard example</figcaption></figure><p>Pros:</p><ol><li><strong>Improved performance</strong>: By dividing a table into smaller partitions, each shard contains a subset of the columns or attributes of the table, reducing the amount of data that needs to be queried. This can lead to faster query execution times and improved performance.</li><li><strong>Reduced write contention</strong>: When multiple clients are trying to update the same table simultaneously, write contention can occur, leading to performance issues. By dividing the table into smaller partitions, write contention can be reduced as writes are directed to specific shards rather than the entire table.</li><li><strong>Increased flexibility</strong>: Vertical sharding allows for the selective scaling of certain portions of the database, which can be useful when certain parts of the system are experiencing higher demand than others. This can result in more efficient use of hardware resources and cost savings.</li><li><strong>Better data management:</strong> Dividing a table into smaller partitions can make it easier to manage and maintain the database. For example, backups and maintenance can be performed on specific shards without affecting other parts of the system.</li></ol><p>Cons:</p><ol><li><strong>Limited scalability</strong>: Vertical sharding can be limiting in terms of scalability, as it may not be possible to partition the database in a way that allows for effective scaling beyond a certain point. This can lead to performance issues as the amount of data grows.</li><li><strong>Complex querying</strong>: Queries that require data from multiple shards can be complex to execute, as data from different shards needs to be combined. This can result in slower query times and increased complexity in application code.</li><li><strong>Higher management overhead</strong>: Vertical sharding requires careful planning and management to ensure that data is distributed effectively across the shards. This can result in higher management overhead and increased complexity in the database infrastructure.</li></ol><h4>Horizontal Sharding</h4><p>Horizontal sharding is a database sharding technique that involves dividing a table into horizontal partitions based on the rows or records of a table. Each shard contains a subset of the rows of the table. This approach is typically used when the data in a table is uniformly distributed and the table is large enough that it cannot be managed on a single server.</p><p>Using the same example of a customer database, horizontal sharding might involve dividing the database based on customer ID ranges. For instance, one shard could contain customer IDs which are odd, another shard could contain customer IDs which are even, and so on. Each shard would be responsible for a subset of the customers, and queries could be distributed across the shards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqfhmlUYbzhFQg2R5brrBg.png" /><figcaption>horizontal shard example</figcaption></figure><p>Similarly, for the product database of an e-commerce website, horizontal sharding could involve dividing the database based on product categories or IDs. For instance, one shard could contain all products in the electronics category, another shard could contain all products in the clothing category, and so on.</p><p>Horizontal sharding can improve query performance by distributing the workload across multiple servers, and it can also improve scalability by allowing for easy addition of more shards as the amount of data grows. However, it can be more complex to implement than vertical sharding, as data must be partitioned based on some criteria, such as a hash of a column value.</p><p>Pros:</p><ol><li><strong>Improved performance</strong>: By dividing a table into smaller partitions, each shard contains a subset of the rows or records of the table, reducing the amount of data that needs to be queried. This can lead to faster query execution times and improved performance.</li><li><strong>Increased scalability</strong>: Horizontal sharding allows for easy addition of more shards as the amount of data grows, making it a more scalable approach than vertical sharding. This can result in better use of hardware resources and cost savings.</li><li><strong>Fault tolerance</strong>: By replicating data across multiple servers, horizontal sharding provides fault tolerance, as data can be easily recovered in case of hardware failure or other issues.</li><li><strong>Better load balancing:</strong> By distributing the workload across multiple servers, horizontal sharding can improve load balancing and prevent one server from becoming a bottleneck.</li></ol><p>Cons:</p><ol><li><strong>Complex querying</strong>: Queries that require data from multiple shards can be complex to execute, as data from different shards needs to be combined. This can result in slower query times and increased complexity in application code.</li><li><strong>Data consistency</strong>: Ensuring data consistency across multiple shards can be challenging, as changes made to one shard may need to be propagated to other shards. This can result in data inconsistencies and conflicts.</li><li><strong>Higher management overhead</strong>: Horizontal sharding requires careful planning and management to ensure that data is distributed effectively across the shards. This can result in higher management overhead and increased complexity in the database infrastructure.</li><li><strong>Higher latency</strong>: In some cases, data may need to be retrieved from multiple shards to satisfy a query, which can result in higher latency and slower query times.</li></ol><h4>Database Sharding vs. Database Replication</h4><p>Database sharding and database replication are two techniques used to scale out a database system. While they both involve distributing data across multiple servers, they differ in their approach.</p><p>Database sharding involves partitioning data across multiple servers, so each server contains a subset of the data. Each shard is responsible for a subset of the workload, and queries can be distributed across the shards. In contrast, database replication involves creating exact copies of the database on multiple servers. Each server is responsible for the same workload, and queries can be directed to any of the replicas.</p><p>When to use database sharding vs. database replication depends on the specific use case. If scalability is the primary concern, database sharding is often the best choice, as it allows for easy scaling by adding additional shards. However, if high availability and fault tolerance are the primary concerns, database replication may be a better choice, as it provides redundancy and failover capabilities.</p><h4>Conclusion</h4><p>Database sharding is an effective technique for scaling out a database system. By distributing data across multiple servers, it can handle larger amounts of data and traffic. There are two types of database sharding: vertical sharding and horizontal sharding, each with its own pros and cons. Choosing between the two depends on the specific use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f7a7c6d4f42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transforming Arrays in JavaScript with the Map Function and Spread Operator]]></title>
            <link>https://medium.com/@shoebsd31/transforming-arrays-in-javascript-with-the-map-function-and-spread-operator-7577d0982853?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7577d0982853</guid>
            <category><![CDATA[array-in-javascript]]></category>
            <category><![CDATA[spread-operator]]></category>
            <category><![CDATA[map-function]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Mon, 10 Apr 2023 08:18:20 GMT</pubDate>
            <atom:updated>2023-04-10T08:18:20.097Z</atom:updated>
            <content:encoded><![CDATA[<p>In JavaScript, “map” and “spread operator” are powerful features that help developers to manipulate and transform arrays and objects with ease. In this article, we’ll explore the concepts of map and spread operator, and how they can be used in JavaScript programming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZPfSwhSCl6V6qAu9v6u0A.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1169316">Gerd Altmann</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1169316">Pixabay</a></figcaption></figure><h4>Map Function</h4><p>The “map” function is a built-in JavaScript method that allows developers to manipulate and transform arrays. It works by iterating over each element in an array, applying a function to each element, and returning a new array with the results. The syntax of the map function is as follows:</p><pre>array.map(function(currentValue, index, arr), thisValue)</pre><p>Here, the “currentValue” parameter represents the current element being processed in the array, the “index” parameter represents the index of the current element being processed, and the “arr” parameter represents the array itself. The “thisValue” parameter is optional and represents the value to be passed as the “this” keyword to the function.</p><p>Here’s an example of using the map function to double each element in an array:</p><pre>const arr = [1, 2, 3, 4, 5];<br>const doubledArr = arr.map((element) =&gt; {<br>  return element * 2;<br>});<br>console.log(doubledArr); // Output: [2, 4, 6, 8, 10]</pre><p>In this example, we define a new array called “arr” with the values [1, 2, 3, 4, 5]. We then use the map function to double each element in the array and store the results in a new array called “doubledArr”. Finally, we log the results of the new array to the console.</p><h4>Spread Operator</h4><p>The “spread operator” is another powerful feature in JavaScript that allows developers to spread the contents of an array or object into another array or object. It is denoted by three dots “…”. The spread operator can be used to concatenate arrays, create new arrays with additional elements, and copy the contents of an array or object. Here’s an example of using the spread operator to concatenate two arrays:</p><pre>const arr1 = [1, 2, 3];<br>const arr2 = [4, 5, 6];<br>const concatenatedArr = [...arr1, ...arr2];<br>console.log(concatenatedArr); // Output: [1, 2, 3, 4, 5, 6]</pre><p>In this example, we define two arrays called “arr1” and “arr2” with the values [1, 2, 3] and [4, 5, 6], respectively. We then use the spread operator to concatenate the two arrays and store the result in a new array called “concatenatedArr”. Finally, we log the results of the new array to the console.</p><p>The spread operator can also be used to create a copy of an array or object. Here’s an example of using the spread operator to copy an array:</p><pre>const arr = [1, 2, 3];<br>const copyArr = [...arr];<br>console.log(copyArr); // Output: [1, 2, 3]</pre><p>In this example, we define an array called “arr” with the values [1, 2, 3]. We then use the spread operator to create a copy of the array and store the result in a new array called “copyArr”. Finally, we log the results of the new array to the console.</p><h4>Conclusion</h4><p>In conclusion, “map” and “spread operator” are powerful features in JavaScript that can help developers to manipulate and transform arrays and objects with ease. The “map” function allows developers to iterate over each element</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7577d0982853" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Fundamentals of Container Networking: Best Practices and Key Considerations]]></title>
            <link>https://medium.com/container-chronicles/the-fundamentals-of-container-networking-best-practices-and-key-considerations-ebc3c8bf2691?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc3c8bf2691</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[cloud-networking]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[container-networking]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Mon, 10 Apr 2023 08:04:37 GMT</pubDate>
            <atom:updated>2023-04-10T08:04:37.560Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>As containers become increasingly popular for application development and deployment, it’s essential to understand how containers interact with the network. This article explores the basics of container networking and provides best practices and key considerations for optimizing network performance and security in containerized environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zyoor62U2IIUNQDb0rZ04A.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3139214">Gerd Altmann</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3139214">Pixabay</a></figcaption></figure><h3>Understand the Networking Model in Containers</h3><p>Containers use a shared network namespace, meaning that all containers on a host share the same network interfaces and IP addresses. This shared network model enables communication between containers on the same host and with external systems. Understanding the networking model in containers is crucial for properly configuring and managing network resources.</p><h3>Optimize Network Performance</h3><p>To optimize network performance in containerized environments, it’s important to consider network bandwidth, latency, and congestion. Utilizing network acceleration technologies, such as TCP offload engines and hardware-based acceleration, can help to improve network performance and reduce latency. Let’s understand it in more details.</p><p><strong>TCP offload engines (TOEs)</strong> are a type of network acceleration technology that offloads TCP/IP processing from the main CPU to a dedicated network interface card (NIC). This allows the main CPU to focus on other tasks, while the TOE handles the heavy lifting of TCP/IP processing. This can result in improved network performance, reduced CPU utilization, and lower latency.</p><p><strong>Hardware-based acceleration</strong> is another type of network acceleration technology that uses specialized hardware to offload network processing from the main CPU. This can include features such as packet filtering, packet forwarding, and protocol offloading. By offloading these tasks to dedicated hardware, the main CPU is free to focus on other tasks, resulting in improved network performance and reduced latency.</p><p>Containers are lightweight, portable, and can be quickly spun up or down as needed. However, as the number of containers and the traffic between them increases, network performance can suffer. Network acceleration technologies can help to optimize network performance in containerized environments by offloading network processing to dedicated hardware or TOEs.</p><h3>Enhance Network Security</h3><p>With containers sharing a network namespace, it’s essential to implement proper network security measures to protect against threats. This includes implementing firewalls, network segmentation, and access control policies to limit network exposure and prevent unauthorized access. Additionally, utilizing encryption and secure communication protocols, such as SSL/TLS, can help to protect sensitive data in transit.</p><p>Securing the network is an important aspect of any container deployment, and Docker provides a number of tools and features to help ensure the security of your containerized applications. In this article, we’ll explore some best practices for securing your Docker network and provide examples of how to implement them.</p><p><strong>Use network isolation:</strong> One of the most effective ways to secure your Docker network is to isolate your containers into separate networks. This ensures that containers can only communicate with other containers on the same network, reducing the risk of unauthorized access or data breaches. To implement network isolation, you can create multiple Docker networks and assign containers to them as needed. For example:</p><pre>docker network create network1<br>docker network create network2<br>docker run --name container1 --network network1 nginx<br>docker run --name container2 --network network2 nginx</pre><p>In this example, we create two Docker networks, network1 and network2, and then assign containers to them using the — network flag.</p><p><strong>Use secure communication:</strong> Another key aspect of securing your Docker network is to use secure communication protocols such as SSL/TLS. This ensures that data transmitted between containers is encrypted and cannot be intercepted or tampered with. To enable SSL/TLS in Docker, you can use the — tls flag when starting the Docker daemon. For example:</p><pre>dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem -H=0.0.0.0:2376</pre><p>In this example, we start the Docker daemon with SSL/TLS enabled using the — tls flag, and provide the necessary certificate and key files.</p><p><strong>Use container security tools: </strong>Docker provides a number of built-in security tools that can help you secure your container network. For example, Docker Security Scanning allows you to scan your container images for vulnerabilities and security issues before deploying them. You can also use Docker Content Trust to ensure that only trusted images are used in your deployment.</p><p><strong>Implement access control: </strong>Access control is another important aspect of securing your Docker network. You can use Docker’s built-in access control features, such as user and group permissions, to control who can access and manipulate containers and networks. For example, you can use the — user flag to run a container as a specific user:</p><pre>docker run --user=1000 nginx</pre><p>In this example, we run the nginx container as user 1000, which limits the container’s access to system resources and files.</p><p><strong>Use firewalls:</strong> Finally, using firewalls can help to further secure your Docker network by controlling traffic flow and blocking unauthorized access. You can use Docker’s built-in firewall, known as the Docker Firewall, or a third-party firewall solution. For example, you can use the ufw firewall in Ubuntu to allow only specific ports:</p><pre>sudo ufw allow 22/tcp<br>sudo ufw allow 80/tcp<br>sudo ufw enable</pre><p>In this example, we allow only SSH and HTTP traffic through the firewall using the ufw command.</p><h3>Consider Network Scalability</h3><p>As containers are deployed and scale, it’s important to consider network scalability. Utilizing container orchestration tools, such as Kubernetes, can help to automate network configuration and management, making it easier to scale resources and manage network traffic. Additionally, leveraging cloud-based network solutions, such as Amazon Web Services (AWS) VPC and Microsoft Azure Virtual Network, can provide scalable network resources for containerized environments. Let’s get in the details.</p><h4>Scaling up a network with Kubernetes</h4><ol><li><strong>Use horizontal pod autoscaling (HPA):</strong> Kubernetes provides HPA, a feature that allows you to automatically scale the number of pods based on application traffic. HPA is based on the metrics collected by Kubernetes, which can be customized based on the application workload. For example, you can use CPU or memory usage as metrics for scaling. With HPA, Kubernetes automatically creates new pods to handle increased traffic and removes them when the traffic decreases.</li><li><strong>Use service discovery: </strong>Service discovery is another important feature of Kubernetes that enables you to manage network traffic between pods. Kubernetes provides a built-in DNS service that allows you to access pods by their service names instead of their IP addresses. Service discovery makes it easier to manage and scale your network, as you don’t have to worry about managing IP addresses.</li><li><strong>Use network policies: </strong>Network policies in Kubernetes allow you to control the network traffic between pods. With network policies, you can define rules for allowing or denying network traffic based on the source and destination pods. Network policies enable you to control the flow of network traffic, which can help you to optimize your network performance and prevent security breaches.</li></ol><p>Let’s understand Amazon Web Services VPC and Azure Virtual Network</p><p>Both AWS VPC and Azure Virtual Network are cloud-based networking services that enable you to create and manage virtual networks. These services provide a range of features and tools that can help you to scale up your network with Kubernetes.</p><p><strong>AWS VPC:</strong> AWS VPC allows you to create and manage virtual networks within the AWS cloud. With AWS VPC, you can create subnets, route tables, and security groups to control the traffic flow between pods. AWS VPC also supports VPN connections, which can help you to securely connect your Kubernetes cluster to other networks, such as on-premises data centers. With AWS VPC, you can also take advantage of Amazon’s other cloud services, such as Amazon Elastic Load Balancing, which can help you to distribute traffic to your Kubernetes pods.</p><p><strong>Azure Virtual Network: </strong>Azure Virtual Network is a similar service offered by Microsoft Azure. With Azure Virtual Network, you can create and manage virtual networks within the Azure cloud. Like AWS VPC, Azure Virtual Network supports subnets, route tables, and security groups to control traffic flow between pods. Azure Virtual Network also supports VPN connections and Azure ExpressRoute, which provides a private connection between your Kubernetes cluster and your on-premises data center. With Azure Virtual Network, you can take advantage of other Azure services, such as Azure Load Balancer, which can help you to distribute traffic to your Kubernetes pods.</p><h3>Conclusion</h3><p>In conclusion, container networking is an essential aspect of containerized environments. Understanding the basics of container networking and utilizing best practices and key considerations can help to optimize network performance, enhance network security, and ensure network scalability. By effectively managing network resources in containerized environments, organizations can maximize the benefits of containers for application development and deployment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc3c8bf2691" width="1" height="1" alt=""><hr><p><a href="https://medium.com/container-chronicles/the-fundamentals-of-container-networking-best-practices-and-key-considerations-ebc3c8bf2691">The Fundamentals of Container Networking: Best Practices and Key Considerations</a> was originally published in <a href="https://medium.com/container-chronicles">Container Chronicles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Networking: Understanding the Fundamentals]]></title>
            <link>https://medium.com/container-chronicles/a-deep-dive-into-docker-networking-understanding-the-fundamentals-c7fc802f970b?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7fc802f970b</guid>
            <category><![CDATA[docker-networking]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[fundamentals]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Tue, 28 Mar 2023 03:59:11 GMT</pubDate>
            <atom:updated>2023-03-28T04:01:11.199Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Docker is a popular platform for building, shipping, and running applications in containers. One of the key aspects of Docker is its networking capabilities, which allow containers to communicate with each other and with the host system. In this article, we’ll take a deep dive into Docker networking, exploring the fundamentals and how they work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdumIgiYo3Fr0OoiRLGoJQ.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/thedigitalartist-202249/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3357642">Pete Linforth</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3357642">Pixabay</a></figcaption></figure><h4>The Default Network Driver: Bridge</h4><p>Docker uses a default network driver called Bridge, which is used to create a virtual network between containers. The Bridge network is created when the Docker daemon starts and is used to connect containers to the host system. By default, each container is assigned a unique IP address on the Bridge network, allowing it to communicate with other containers and the host system.</p><h4>User-Defined Networks</h4><p>In addition to the default Bridge network, Docker also allows users to create custom, user-defined networks. User-defined networks can be used to isolate containers from each other or to create a custom network topology, such as a multi-host network. To create a user-defined network, use the docker network create command, and then use the --network option when starting containers to connect them to the network.</p><h4>Port Mapping</h4><p>Docker provides the ability to map ports between containers and the host system. This allows containers to expose services to the host system or to other containers. To map a port, use the -p or --publish option when starting a container, specifying the host port and container port separated by a colon. For example, to map port 80 in the container to port 8080 on the host system, you would use the following command:</p><pre>docker run -p 8080:80 my_image</pre><h4>Link Containers</h4><p>Another way to communicate between containers is to link containers. When linking containers, one container is able to access the environment variables of another container, allowing it to connect to the network and communicate with the other container. To link containers, use the --link option when starting a container, specifying the name of the container to be linked.</p><h4>Network Plugins</h4><p>Docker also provides the ability to extend its networking capabilities through the use of network plugins. Network plugins are third-party components that provide additional network features and functionality, such as service discovery, load balancing, and network security. Some popular network plugins for Docker include Calico, Weave, and Flannel.</p><h4>Conclusion</h4><p>In conclusion, Docker networking is a powerful feature that allows containers to communicate with each other and the host system. From the default Bridge network to custom, user-defined networks and the ability to map ports and link containers, Docker provides a variety of options for configuring and managing network communication between containers. Understanding these fundamental concepts is essential for building and deploying applications in Docker.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7fc802f970b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/container-chronicles/a-deep-dive-into-docker-networking-understanding-the-fundamentals-c7fc802f970b">Docker Networking: Understanding the Fundamentals</a> was originally published in <a href="https://medium.com/container-chronicles">Container Chronicles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Mistakes to Avoid When Setting Up a Docker Swarm]]></title>
            <link>https://medium.com/container-chronicles/common-mistakes-to-avoid-when-setting-up-a-docker-swarm-c532b6115bf7?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c532b6115bf7</guid>
            <category><![CDATA[mistakes]]></category>
            <category><![CDATA[docker-swarm]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Mon, 27 Mar 2023 14:30:14 GMT</pubDate>
            <atom:updated>2023-03-27T14:30:14.598Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Introduction</strong></h4><p>Docker Swarm is a powerful tool for managing containers and services in a cluster of Docker nodes. However, setting up a Swarm can be challenging, and many users make mistakes that can result in issues with performance, security, and scalability. In this article, we’ll explore some of the most common mistakes made when setting up a Docker Swarm, and what you can do to avoid them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qT3Zws8E1CGmyiLzn6JT6A.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3286016">Gerd Altmann</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3286016">Pixabay</a></figcaption></figure><h4><strong>Not Configuring the Overlay Network Properly</strong></h4><p>One of the most common mistakes made when setting up a Swarm is not configuring the overlay network properly. The overlay network is used to connect nodes in the Swarm and enable communication between services. If the overlay network is not configured properly, services may be unable to communicate with each other, leading to issues with performance and scalability.</p><p>To avoid this mistake, be sure to understand the requirements for the overlay network, such as the subnet size, IP address range, and network driver. You should also ensure that the network is properly configured, with all nodes in the Swarm able to reach each other on the overlay network.</p><h4><strong>Not Securing the Swarm with TLS</strong></h4><p>Another common mistake is not securing the Swarm with TLS. TLS is used to encrypt communication between nodes in the Swarm and prevent eavesdropping and tampering. If the Swarm is not secured with TLS, sensitive data may be vulnerable to interception, putting the security of your infrastructure at risk.</p><p>To avoid this mistake, be sure to secure the Swarm with TLS by generating and deploying a valid certificate and key pair. You should also configure the Swarm to use TLS by default, and enforce secure communication between nodes in the Swarm.</p><h4>Not Managing Secrets Properly</h4><p>Secrets are sensitive data, such as passwords, API keys, and encryption keys, that need to be stored securely in a Swarm. Not managing secrets properly can result in sensitive data being exposed, compromising the security of your infrastructure.</p><p>To avoid this mistake, be sure to use the secrets management features in Docker Swarm, such as secrets management and config management. You should also store secrets securely and use proper access controls to limit access to sensitive data.</p><h4>Not Monitoring the Swarm</h4><p>Monitoring the Swarm is important for ensuring that it is running smoothly and identifying potential issues before they become problems. Not monitoring the Swarm can result in performance issues and potential data loss, as well as making it difficult to identify and resolve issues.</p><p>To avoid this mistake, be sure to monitor the Swarm regularly, using tools such as the Docker API, the Docker Engine API, and third-party monitoring tools. You should also use logs and metrics to monitor the performance of the Swarm and identify potential issues.</p><h4>Conclusion</h4><p>In conclusion, setting up a Docker Swarm can be challenging, and many users make mistakes that can result in issues with performance, security, and scalability. By understanding and avoiding these common mistakes, you can ensure that your Swarm is running smoothly and securely, and avoid potential issues in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c532b6115bf7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/container-chronicles/common-mistakes-to-avoid-when-setting-up-a-docker-swarm-c532b6115bf7">Common Mistakes to Avoid When Setting Up a Docker Swarm</a> was originally published in <a href="https://medium.com/container-chronicles">Container Chronicles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript callback in simplest terms]]></title>
            <link>https://medium.com/@shoebsd31/javascript-callback-in-simplest-terms-ebaba511e58d?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebaba511e58d</guid>
            <category><![CDATA[callback-function]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[callback]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 10:51:54 GMT</pubDate>
            <atom:updated>2023-03-22T10:51:54.358Z</atom:updated>
            <content:encoded><![CDATA[<p>In JavaScript, a callback is a function that is passed as an argument to another function and is called by that function. The purpose of a callback is to allow a function to execute some code after another function has completed its task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jd7fW34iuduyYByLlzWWnA.png" /><figcaption>callback</figcaption></figure><p>Here’s an example of a simple JavaScript function that takes a callback as an argument:</p><pre>function doSomething(callback) {<br>  console.log(&quot;Doing something...&quot;);<br>  callback();<br>}</pre><p>This function takes a single argument called callback, which is a function that will be executed after the doSomething() function has completed its task. The console.log() statement is just a placeholder for some real work that the function would perform.</p><p>Now, let’s create a function that we can pass as a callback to doSomething():</p><pre>function sayDone() {<br>  console.log(&quot;Done!&quot;);<br>}</pre><p>This function simply logs a message to the console to indicate that it has been called.</p><p>Finally, let’s call doSomething() and pass sayDone() as a callback:</p><pre>doSomething(sayDone);</pre><p>When this code is executed, the following output will be logged to the console:</p><pre>Doing something...<br>Done!</pre><p>This is because the doSomething() function first logs &quot;Doing something...&quot;, then calls the callback function that was passed to it (in this case, sayDone()), which logs &quot;Done!&quot; to the console.</p><p>In summary, a callback is a function that is passed as an argument to another function and is executed after that function has completed its task. They are a powerful tool for creating asynchronous and event-driven code in JavaScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebaba511e58d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Achieving Immutability in C#]]></title>
            <link>https://medium.com/@shoebsd31/best-practices-for-achieving-immutability-in-c-e0375b11f77d?source=rss-90d8255c3ba3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0375b11f77d</guid>
            <category><![CDATA[immutability]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[shoeb sayyed]]></dc:creator>
            <pubDate>Sun, 12 Mar 2023 11:57:18 GMT</pubDate>
            <atom:updated>2023-03-12T12:00:01.908Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>Immutability is a key concept in software engineering and it is essential to ensure the integrity of your data and prevent unintended changes. In software development, immutability refers to the practice of creating objects that cannot be modified once they are created. This ensures that the state of an object remains consistent throughout its lifecycle, making it easier to reason about the behavior of your code and to avoid unintended consequences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*x2eddJ3dyI3jWBrftJ-agQ.jpeg" /><figcaption>source : stock.adobe.com</figcaption></figure><p>In C#, immutability can be achieved by using value types and by using objects that are specifically designed to be immutable. In this blog, we will explore some of the best practices for achieving immutability in C#.</p><h4>Use value types</h4><p>Value types in C# are always immutable. Examples of value types include integers, floating-point numbers, and dates. When you use a value type, you can be sure that its value will not change during its lifetime, making it ideal for use in scenarios where immutability is important.</p><h4>Use read-only properties</h4><p>Another way to achieve immutability in C# is to use read-only properties. In C#, you can create read-only properties by using the readonly keyword. This ensures that the value of the property cannot be changed once it is set.</p><p>For example:</p><pre>class MyClass<br>{<br>    public readonly int MyInt;<br>    public MyClass(int myInt)<br>    {<br>        MyInt = myInt;<br>    }<br>}</pre><p><strong>Use the </strong><strong>ImmutableArray type</strong></p><p>The ImmutableArray type is a specialized type that is designed to be immutable. It is available in the System.Collections.Immutable namespace and provides an array that cannot be modified after it is created. This is useful in scenarios where you want to ensure that the data in the array remains unchanged.</p><p>For example:</p><pre>var array = ImmutableArray.Create(1, 2, 3, 4);</pre><p><strong>Use the </strong><strong>ImmutableList type</strong></p><p>The ImmutableList type is similar to the ImmutableArray type, but provides a list instead of an array. Like the ImmutableArray, the ImmutableList is designed to be immutable and provides a way to ensure that the data in the list remains unchanged.</p><p>For example:</p><pre>var list = ImmutableList.Create(1, 2, 3, 4);</pre><p><strong>Use the </strong><strong>ImmutableDictionary type</strong></p><p>The ImmutableDictionary type is a specialized type that provides an immutable dictionary. It is available in the System.Collections.Immutable namespace and provides a dictionary that cannot be modified after it is created. This is useful in scenarios where you want to ensure that the data in the dictionary remains unchanged.</p><p>For example:</p><pre>var dictionary = ImmutableDictionary.Create&lt;string, int&gt;();<br>dictionary = dictionary.Add(&quot;Key1&quot;, 1);<br>dictionary = dictionary.Add(&quot;Key2&quot;, 2);</pre><h4>Conclusion</h4><p>In conclusion, immutability is an important concept in software engineering and there are several best practices for achieving immutability in C#. By using value types, read-only properties, and the specialized Immutable types, you can ensure that your data remains unchanged and avoid unintended consequences.</p><p>“<strong>Immutability is the cornerstone of robust and maintainable code.</strong>” — Martin Fowler</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0375b11f77d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>