<?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 Bazla Kausar on Medium]]></title>
        <description><![CDATA[Stories by Bazla Kausar on Medium]]></description>
        <link>https://medium.com/@kausarbazla?source=rss-848e8d226503------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JyarhdU9hG9ajj_uiuxXrw.jpeg</url>
            <title>Stories by Bazla Kausar on Medium</title>
            <link>https://medium.com/@kausarbazla?source=rss-848e8d226503------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:12:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kausarbazla/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[The Art and Science of Data Engineering: Building the Backbone of Data-Driven Success]]></title>
            <link>https://medium.com/@kausarbazla/the-art-and-science-of-data-engineering-building-the-backbone-of-data-driven-success-51ebe180b895?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/51ebe180b895</guid>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 10:52:25 GMT</pubDate>
            <atom:updated>2025-07-27T10:52:25.715Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWXwTpO4w9MdoEGECQS3lg.png" /></figure><p>Whether you’re just starting in data engineering, an experienced professional brushing up on fundamentals, or a business leader trying to understand the value of data engineering, this blog series is for you!</p><p>Imagine walking into a bustling city for the first time. You’re surrounded by chaotic traffic, a sea of pedestrians, and a maze of buildings. At first glance, it all seems like an incomprehensible jumble. But hidden beneath this apparent chaos is an intricate, well-organised infrastructure that makes everything work seamlessly — from the roads and traffic lights to the water supply and electricity grid. This hidden infrastructure is what keeps the city alive and thriving.</p><p>Now, let’s shift our perspective to the world of business. Here, data is the lifeblood that flows through every decision, strategy, and operation. But like the city, the raw data at first seems like a chaotic mess. It comes from various sources: sales transactions, social media interactions, sensor readings, and more. How does this seemingly disorganized torrent of information transform into actionable insights that drive business success?</p><p>In today’s data-centric world, businesses of all sizes rely on vast amounts of data to drive decision-making, optimize operations, and gain a competitive edge. But how does this data go from raw, unstructured information to actionable insights? This transformation is made possible by data engineering, an essential field that lays the groundwork for data analytics and machine learning.</p><h4>What is Data Engineering?</h4><p>Data engineering involves designing, building, and maintaining systems and architectures that collect, store, process, and analyze large volumes of data.<br>It involves creating data pipelines that automate the movement and transformation of data from various sources to centralized repositories, making it accessible and useful for data scientists, analysts, and business intelligence professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xtQMLhIdGH3lxO_5FMQFvQ.gif" /></figure><h4>Key Components of Data Engineering</h4><ol><li><strong>Data Collection and Ingestion</strong>:<br><strong>Sources</strong>: Data can come from multiple sources such as transactional databases, APIs, sensors, social media, and more.<br><strong>Techniques</strong>: Techniques like batch processing, stream processing, and real-time data ingestion are used to gather data efficiently.</li><li><strong>Data Storage and Warehousing</strong>:<br><strong>Databases</strong>: Relational databases (e.g., MySQL, PostgreSQL) and NoSQL databases (e.g., MongoDB, Cassandra) are used for storing data.<br><strong>Data Warehouses</strong>: Data warehouses (e.g., Amazon Redshift, Google BigQuery, Snowflake) provide a central repository for integrated data from multiple sources, optimized for querying and analysis.</li></ol><p><strong>3. Data Transformation and Processing</strong>:</p><p><strong>ETL/ELT</strong>: Extract, Transform, Load (ETL) or Extract, Load, Transform (ELT) processes clean, transform, and load data into the desired format and structure.<br><strong>Frameworks</strong>: Tools and frameworks like Apache Spark, Apache Flink, and Apache Beam enable large-scale data processing and transformation.</p><p><strong>4. Data Orchestration and Workflow Management</strong>:<br><strong>Orchestration Tools</strong>: Tools like Apache Airflow, Prefect, and Luigi manage and automate complex data workflows and pipelines.</p><p><strong>5. Data Quality and Governance</strong>:<br><strong>Data Quality</strong>: Ensuring data accuracy, completeness, consistency, and reliability through validation, cleansing, and monitoring.<br><strong>Data Governance</strong>: Implementing policies and practices for data management, security, privacy, and compliance.</p><p><strong>6. Data Access and Consumption</strong>:<br><strong>APIs</strong>: APIs enable secure and controlled access to data for applications and services.<br><strong>BI Tools</strong>: Business Intelligence (BI) tools like Tableau, Power BI, and Looker facilitate data visualisation and reporting.</p><h4>The Role of a Data Engineer</h4><p>Data engineers are responsible for building and maintaining the infrastructure that supports data processing and analysis. Their tasks include:</p><ul><li>Designing and implementing scalable data architectures.</li><li>Developing and maintaining data pipelines for ETL processes.</li><li>Ensuring data quality and implementing data governance practices.</li><li>Collaborating with data scientists and analysts to understand data needs.</li><li>Optimising database and query performance for efficient data retrieval.</li></ul><h4>Why is Data Engineering Important?</h4><p>Data engineering is crucial because it ensures that data is accessible, reliable, and ready for analysis. Without a robust data engineering foundation, organisations struggle to extract meaningful insights from their data, leading to missed opportunities and inefficiencies. By investing in data engineering, businesses can unlock the full potential of their data, driving innovation and growth.</p><h4>Breaking It Down…</h4><h4>1. ETL vs. ELT: Making Data Ready for Action</h4><p>Every data journey starts with data <strong>extraction</strong>, but simply grabbing data isn’t enough. The magic lies in ETL (<strong>Extract, Transform, Load</strong>) and ELT (<strong>Extract, Load, Transform</strong>).</p><ul><li><strong>ETL</strong>: Data is first extracted from a source (e.g., databases, APIs), transformed (cleaned, structured), and then loaded into a target system like a data warehouse.</li><li><strong>ELT</strong>: In this approach, data is first extracted and loaded in raw form into a storage system, and transformations happen later, often in the data warehouse.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2AV8Pg0s5xwWW9cNFhWyw.png" /></figure><p>Let’s take an example of a <strong>Retail Company Optimising Customer Insights,</strong> Imagine a retail chain like <strong>ShopEasy</strong> that operates hundreds of stores and an e-commerce platform. Every day, they generate massive amounts of data from:<br> → Sales transactions at physical stores.<br> → Website visits, clicks, and purchases online.<br> → Customer feedback from social media and surveys.</p><p>To make this data actionable:<br> → Using the <strong>ETL approach</strong>, ShopEasy extracts data from transactional systems (like POS systems and website logs), transforms it into a clean, structured format (e.g., combining store and online sales by customer), and loads it into a <strong>data warehouse</strong> like Snowflake. This allows the company to generate daily sales reports and customer behavior insights.<br> → With the <strong>ELT approach</strong>, ShopEasy loads all raw data directly into a cloud-based data lake, like Amazon S3 &amp; transforms it. This method is especially useful for unstructured data (e.g., customer comments) that requires exploration before cleaning.<br><strong><em>These approaches empower ShopEasy to improve customer targeting, optimize inventory, and enhance the overall shopping experience.</em></strong></p><h4>2. The Highways of Data: Data Pipelines</h4><p>A <strong>data pipeline</strong> is like a factory assembly line that automates the journey of data from one point to another. You can think of it as the path data takes from collection to processing, storage, and eventual use in analytics or machine learning.</p><ul><li><strong>Batch pipelines</strong> collect data at intervals (e.g., hourly or daily) and process it in chunks. This is useful for generating daily reports or running nightly jobs.</li><li><strong>Real-time pipelines</strong> handle data as it comes in, giving businesses instant insights — think of stock trading systems or online recommendation engines.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AyXUHe2DoMJZr5tLOlD2gQ.gif" /></figure><h4>3. Data Lakes vs. Data Warehouses: Where Does Data Go?</h4><ul><li>A <strong>data lake</strong> is a vast pool of raw data that can be structured or unstructured. It’s flexible and useful for data scientists who need access to large datasets for advanced analytics and machine learning.</li><li>A <strong>data warehouse</strong>, on the other hand, contains neatly organized, structured data that’s ready for analysis by business intelligence tools. It’s the go-to for analysts who need reliable and cleaned data for reporting.</li></ul><p><strong>Example: Netflix’s Data Architecture<br></strong> Netflix handles an enormous volume of data daily from:<br> → User interactions like search queries, playbacks, and recommendations.<br> → System logs for service performance and error tracking.<br> → Content metadata for categorization and personalization.</p><p>To handle this diversity:<br>1. <strong>Data Lake for Machine Learning</strong><br>Netflix stores raw, unstructured data in a data lake (e.g., AWS S3). Data scientists use this to train recommendation algorithms or analyze viewer preferences for new content creation. For instance, machine learning models predict which genres a user might like based on their watch history.<br>2. <strong>Data Warehouse for Analytics</strong><br>Cleaned, structured data is loaded into warehouses like Snowflake or Google BigQuery for business analytics. Netflix uses this to generate insights like:<br> → What’s the most-watched show in a specific region?<br> → How effective was a recent marketing campaign?<br> → Which subscription plans are driving the most revenue?</p><p><strong><em>By using both systems, Netflix ensures that raw data feeds innovation (via machine learning), while structured data drives decision-making for business operations.</em></strong></p><h4>4. The Blueprint for Data Storage: Schema Design</h4><p>Designing a <strong>schema</strong> is like laying the foundation for a building. A good schema helps organize data efficiently and ensures fast, reliable access. It defines how data will be stored in tables, making future queries easy.</p><p>Popular schema designs include:</p><ul><li><strong>Star Schema</strong>: Great for data warehouses, where all data points to a central fact table.</li><li><strong>Snowflake Schema</strong>: An extension of the star schema but more normalized, reducing redundancy.</li></ul><h4>5. Balancing Efficiency: Normalization vs. Denormalization</h4><p><strong>Normalization</strong> organizes data to reduce redundancy, saving storage space, while <strong>denormalization</strong> improves query performance by duplicating data for quicker reads. Data engineers often balance the two based on the system&#39;s needs.</p><h4>6. The Tech Behind the Magic: Distributed Systems</h4><p>As data grows, a single machine can’t handle it all. <strong>Distributed systems </strong>like Apache Hadoop and Apache Spark split data processing across multiple machines, allowing businesses to easily handle huge datasets.</p><h4>7. Data Partitioning and Sharding: Divide and Conquer</h4><p><strong>Partitioning</strong> divides data into smaller chunks to improve performance, especially for large tables. <strong>Sharding</strong> goes one step further by spreading those chunks across different servers. Both techniques help in scaling databases efficiently.</p><h3>Conclusion</h3><p>As we delve deeper into the world of data engineering in this series, you’ll learn about the tools, techniques, and best practices that can help you transform your data into actionable insights. Whether you’re a budding data engineer or a business leader looking to harness the power of data, there’s something here for everyone.</p><h3>🚀 <strong>Up next</strong></h3><p>We’ll explore how traditional warehousing concepts like <strong>OLTP vs OLAP</strong> and <strong>schema design</strong> laid the foundation for today’s modern data systems.<br>Stay tuned for <strong>Schema Design 101</strong> and practical insights on designing <strong>scalable data architectures</strong>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51ebe180b895" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airflow: Sensors, Operators & Hooks !]]></title>
            <link>https://medium.com/@kausarbazla/airflow-sensors-operators-hooks-99cb077c5dd1?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/99cb077c5dd1</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[data-engineer]]></category>
            <category><![CDATA[apache-airflow]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Fri, 04 Aug 2023 13:55:57 GMT</pubDate>
            <atom:updated>2023-08-04T13:55:57.816Z</atom:updated>
            <content:encoded><![CDATA[<h3>Airflow: Sensors, Operators &amp; Hooks !</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X3WGY1ajqbo-AZoQ2IrYRg.png" /></figure><p>Welcome back! In our previous blog, we delved into the fundamentals of <a href="https://medium.com/@kausarbazla/airflow-and-data-engineers-a94cd853862b">Airflow</a>, exploring its purpose, functionality, and mechanics. Now, let’s take our knowledge a step further as we dive into the exciting world of airflow sensors and learn how they can automatically trigger DAGs upon data arrival on the server.</p><p>Although DAGs are used to structure jobs and define the context in which they will be executed, DAGs don’t actually carry out computation. <br><strong>Tasks</strong>, on the other hand, are the component of Airflow that “<strong>do the work</strong>” we need done. Tasks come in two varieties: <strong>operators</strong> and <strong>sensors</strong>. Operator tasks carry out some explicit operation, in which case they are referred to as such; sensors halt the execution of dependent tasks until some criterion has been satisfied. In theory, Operators are capable of carrying out any Python function. The status of any process or data structure can also be determined using sensors.</p><h4>Data Pipelines with Seamless Integration : Airflow Hooks</h4><p>Airflow Hooks are Reusable parts that makes it easier to communicate with other systems and services. They manage operations like connection management, authentication, and data transfer, abstracting the difficulties of API integrations, and offer a standardised interface for communicating with multiple services. Key characteristics of Hooks include:</p><p>📍 <strong>Abstraction</strong>: Hooks make it possible to connect with external systems consistently and logically by abstracting away the complexities of their APIs.</p><p>📍 <strong>Extensibility</strong>: To meet the unique requirements of your data pipeline integrations, hooks can be simply customised or extended.</p><p>📍 <strong>Modularity</strong>: Because they are self-contained and reusable, hooks make it easier to organise your code and eliminate duplication in your workflows.</p><h4>Leveraging Prebuilt Airflow Hooks for Seamless Integration</h4><p>Numerous prebuilt Hooks are available in Apache Airflow for communicating with well-known systems and services, including message queues, cloud platforms, and databases. Prebuilt hooks that are frequently used includes:<br>👉 PostgresHook<br>👉 BigQueryHook<br>👉 SlackWebhook<br>👉 S3Hook<br>👉HttpHook</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNBXmPxL7JjP-yXoWffhgA.jpeg" /></figure><h4>How To Create Custom Airflow Hooks</h4><p>If a prebuilt Hook does not satisfy your needs, you can extend the the airflow.hooks.base.BaseHook class. To generate a unique Hook, take the following actions:</p><ol><li>Include any necessary dependencies along with the BaseHook class. <br>2. Create your own Hook class that derives from BaseHook. <br>3. Use the necessary techniques to connect and communicate with the external system.</li></ol><h4>Do you want your DAG to get Automatically triggered when data arrives on the server ?</h4><p>Apache Airflow has some specialised operators that are made to wait for something to happen. They are called <strong>Sensors</strong>. <br>Before marking a sensor run as successful and permitting the execution of downstream operations, sensors first check to see if a predetermined condition is satisfied. They can be an excellent tool for making your DAGs more event-driven if utilised appropriately.</p><h4>Sensor Types in Apache Airflow</h4><p>👉 <strong>SqlSensor</strong>: runs a SQL query and watches for a specified result to come back.<br>When tasks depend on the status of a database or when you need to make sure that a specific database condition is satisfied before going on to the next activity, SqlSensor can be especially helpful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hn_KhHW7CrVxFZP1hrHUBA.jpeg" /><figcaption>SQL Sensor example</figcaption></figure><p>👉 <strong>TimeSensor</strong>: waits till a certain time has passed<br>👉 <strong>HttpSensor</strong>: waits for a specified response from an HTTP endpoint.<br>When tasks depend on the availability of external APIs or when you need to make sure that an API has finished processing before going on to the next job, HttpSensor is especially helpful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wC9lYsbxbBXwMzGbgYpIog.jpeg" /><figcaption>HTTP Sensor Example</figcaption></figure><p>👉 <strong>TimeDeltaSensor</strong>: waits until a particular time delta has passed<br>👉<strong>ExternalTaskSensor</strong>: waits for another operation to finish in a different DAG<br>👉 <strong>FileSensor</strong>: waits for the presence of a file or directory in a given place</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OXtdw1Sy8HyRVyf_Z4LvQ.jpeg" /><figcaption>File Sensor Example</figcaption></figure><h4>Efficiently Using Sensors in Apache Airflow</h4><p>📍 <strong>Handle sensor timeouts</strong>: Using the <strong>on_failure_callback </strong>or <strong>trigger_rule</strong> options, you can set up your workflow to retry the action, notify recipients, or perform alternative tasks in the event that a Sensor times out.</p><p>📍 <strong>Set</strong> <strong>timeouts</strong>: To avoid your sensors from waiting indefinitely, which might result in resource consumption and stalled operations, configure reasonable timeout values for them.</p><p>📍 <strong>Use poke intervals</strong>: In order to balance the frequency of checks with the overall effectiveness of your workflows, set appropriate poke intervals for your sensors.</p><p>📍 <strong>Monitor</strong> <strong>sensor</strong> <strong>performance</strong>: Use the built-in monitoring features of Airflow, such as the job duration chart and the Gantt chart, to keep an eye on the performance of your Sensors. You can discover bottlenecks and improve your workflow using this.</p><h3>Operators</h3><p>Execution engines commonly plays role of operators. Depending on the type of operator, tasks are created using operators that carry out specific processes. A job that will execute a certain Python method, for instance, can be created using the PythonOperator.</p><h4>Types Of Operators</h4><p><strong>➾ Airflow Bash Operators</strong>: With Apache Airflow’s BashOperator, you may run Bash scripts or commands as tasks inside DAGs. With the help of this operator, you can quickly include shell commands and scripts into your workflows. You can use Bash’s efficiency and adaptability to carry out a variety of tasks, including data processing, file manipulation, and system interaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJX1uagD4JoQbvmehH0gsw.jpeg" /><figcaption>Bash Operator Example</figcaption></figure><p>The BashOperator must first be imported from the airflow.operators.bash_operator module before it can be used. You may then build a BashOperator instance within your DAG by specifying the <strong>bash_command</strong> parameter and any additional optional arguments, such as <strong>env</strong> and <strong>xcom_push</strong>.</p><p><strong>➾ Airflow Python Operators:</strong> Utilising Apache Airflow’s PythonOperator, you may run Python programmes as DAG tasks. With the help of this operator, you can quickly include Python code into your workflows. You may use Python’s strength and adaptability for a variety of activities, including data processing, making API calls, and connecting with databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Hgws4Q_QNZVN4LjymsGlA.jpeg" /><figcaption>Python Operator Example</figcaption></figure><p>The PythonOperator must first be imported from the airflow.operators.python_operator module before being used. When creating a PythonOperator instance within your DAG, be sure to include the python_callable parameter as well as any other parameters your function may need.</p><p><strong>➾ Airflow Email Operators: </strong>With Apache Airflow’s EmailOperator, you are able to send email notifications as DAG jobs. With the help of this operator, you can easily inform stakeholders when a task is finished, fails, or involves other significant workflow events, enhancing visibility and fostering better collaboration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFMey1YbKpHsDJ8RAVb8Ng.jpeg" /><figcaption>Email Operator Example</figcaption></figure><p>The EmailOperator must first be imported from the <strong>airflow.operators.email_operator</strong> module before it can be used. In your DAG, you can then build an instance of the EmailOperator by specifying the necessary parameters like to, topic, and html_content.</p><p><strong>➾</strong> <strong>Airflow Mysql Operator: </strong>Apache Airflow’s MySqlOperator is a strong operator that enables you to run SQL statements against a MySQL database. This operator makes it simple to incorporate MySQL database operations into your data pipelines and is a component of the <strong><em>airflow.providers.mysql.operators.mysql </em></strong>package.</p><p>You must first establish a connection to your MySQL database in Airflow before you can use the MySqlOperator. Follow these steps to accomplish this:</p><p>→ Go to the <strong><em>Admin</em></strong> menu on the Airflow UI by navigating there.<br> → Click <strong><em>Connections</em></strong> and then click on<strong><em> +</em></strong> to add a new record.<br> → Complete the necessary fields:<strong><em>mysql_conn</em></strong> is an example of a Conn Id, which is a connection’s special identifier.<br>📍<strong><em>Conn</em></strong> <strong><em>Type</em></strong>: From the drop-down box, select <strong>MySQL</strong><br>📍 <strong><em>Host</em></strong>: Your MySQL server’s hostname or IP address.<br>📍 <strong><em>Schema</em></strong>: If applicable, the default database schema to use.<br>📍 <strong><em>Login</em></strong>: Enter your MySQL username to log in.<br>📍 <strong><em>Password</em></strong>: Your MySQL password is the password.<br>📍 <strong><em>Port</em></strong>: The port that your MySQL server is currently using (the default is <strong>3306</strong>).<br>📍 Click <strong><em>Save</em></strong> to create the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQlGeBVNPatAeJvFIvvuUQ.jpeg" /><figcaption>Mysql Operator Example</figcaption></figure><p><strong>➾ Airflow Spark Submit Operators: </strong>The SparkSubmitOperator makes it simple to incorporate massive data processing activities into your data pipelines by allowing you to submit Spark applications inside of your DAGs.</p><p>The Apache Airflow operator known as SparkSubmitOperator is used to submit and run Apache Spark applications. It interacts with Spark using the spark-submit command-line tool and derives from the BaseOperator class.<br><strong>Use Cases:<br></strong>📍 <strong><em>Data transformation</em></strong><br>📍 <strong><em>Data loading</em></strong><br>📍 <strong><em>Data extraction</em></strong><br>📍 <strong><em>Data analysis</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFprIaGHlpHCsdikg3K_Rg.jpeg" /><figcaption>Spark Submit Operator Example</figcaption></figure><p><strong>➾ Airflow Dummy Operators: </strong>In Apache Airflow, the DummyOperator is a no-op operator that performs nothing. It is essentially a stand-in task that may be used to different DAG tasks. Despite its simplicity, the DummyOperator class, which derives from the BaseOperator class, can be a useful tool for structuring and organising your workflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViexaL0-w8x29oPZWkywIg.jpeg" /><figcaption>Dummy Operator Example</figcaption></figure><h3>Wrapping Up!</h3><p>In conclusion, Apache Airflow’s operators, sensors, and hooks serve as the backbone of data orchestration, enabling data teams to build reliable, scalable, and adaptable data pipelines. By combining these components effectively and following best practices, organizations can achieve data-driven success while maintaining code simplicity, maintainability, and efficiency. As the data landscape continues to evolve, mastering these fundamental building blocks will undoubtedly be a key asset for any data engineering or data science endeavour.</p><h4>Further Reading and Resources</h4><p>→ <a href="https://medium.com/@kausarbazla/airflow-and-data-engineers-a94cd853862b">Airflow &amp; Data Engineers</a><br>→ <a href="https://airflow.apache.org/docs/apache-airflow/1.10.3/concepts.html">https://airflow.apache.org/docs/apache-airflow/1.10.3/concepts.html</a><br>→ <a href="https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/operators/bash/index.html">https://airflow.apache.org/docs/apache- airflow/stable/_api/airflow/operators</a><br>→ <a href="https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/sensors.html">https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/sensors.html</a><br>→ <a href="https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/sensors.html">https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/sensors.html</a><br>→ <a href="https://medium.com/@kausarbazla3/unlocking-the-power-of-elastic-search-apis-a-comprehensive-guide-96f30b29c99f">Unlocking The Power Of Elastic Search</a><br>→ <a href="https://medium.com/@kausarbazla3/mastering-elasticsearch-index-management-tips-tricks-c36a26916477">Mastering Elastic Search Index Management</a><br>→ <a href="https://medium.com/@kausarbazla/elastic-search-101-6d39bb933664">Introduction To Elastic Search</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99cb077c5dd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airflow and Data Engineers]]></title>
            <link>https://medium.com/@kausarbazla/airflow-and-data-engineers-a94cd853862b?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/a94cd853862b</guid>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Tue, 20 Jun 2023 12:27:45 GMT</pubDate>
            <atom:updated>2023-06-20T12:27:45.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xIhd-Kl6Cicz2da8DpMzPA.png" /></figure><p>Airflow was initiated by <strong>Airbnb</strong> as an open-source project in 2014,<br> irflow was accepted into the Apache Software Incubator Programme in 2016 and in 2019, it was declared a Top-Level Apache Project. It is now universally acknowledged as the best workflow management tool available.<br>Apache Airflow lets you programmatically author, schedule, and monitor your data pipelines using Python.</p><p>Users of Airflow can create workflows as task-based Directed Acyclic Graphs (DAGs). With Airflow’s sophisticated user interface, it’s simple to visualise pipelines that are currently in use, keep track of their progress, and address problems as they arise. When a task succeeds or fails, it can send an alert via email or Slack and links to different data sources. Given its distributed architecture, scalability, and flexibility, Airflow is a good choice for orchestrating complicated business logic.</p><h4>Who can use Airflow ?</h4><p>Data engineers can leverage Airflow’s support for hundreds of pre-built Airflow operators and thousands of Python modules and frameworks to build the data pipelines they need to collect, transfer, and modify data. Data engineers can create dependable data pipelines by managing job dependencies and recovering from errors with Airflow.</p><h4>Why Airflow ?</h4><ol><li><strong>Versatility, Adaptability, and Scalability:</strong> Airflow can expand from snall deployments with a handful of users and data pipelines to enormous deployments with thousands of pipelines and many concurrent users. Being a Python based tool, it supports all of the libraries, frameworks, and modules that are available for Python.</li><li><strong>Ease of use: </strong>Airflow makes data pipeline creation easier by allowing customers to define their pipelines as Python code. The web-based user interface (UI) of Airflow streamlines task management, scheduling, and monitoring while offering quick glimpses into the efficiency and development of data pipelines.</li><li><strong>Open source:</strong> The platform is steered, improved, and supported by an extensive group of active maintainers, committers, and contributors who work on Airflow.</li><li><strong>Seamless Integrations: </strong>It is a tried-and-true option for businesses that needs robust, cloud-native workflow management. Asynchronous task support, data-aware scheduling, and tasks that adapt to input conditions are just a few of the useful new features that each new release of Airflow brings. These features give businesses even more freedom to design, implement, and manage their workflows.</li></ol><h3>What is Airflow used for ?</h3><p>Data pipelines or workflows are scheduled and managed using Apache Airflow. The management, sequencing, coordination, and scheduling of intricate data pipelines from several sources is referred to as <strong><em>orchestration</em></strong> of data pipelines. These data pipelines produce data sets that are prepared for consumption by big data applications, data science, and machine learning models.</p><p>These workflows are shown as Directed Acyclic Graphs (DAG) in Airflow. To further understand what a workflow/DAG is, let’s make a burger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzmnYR3PvUmIzn8Yc93H5g.jpeg" /></figure><p>Workflows typically have an objective, like producing visuals. The DAG now demonstrates how each step depends on a number of prerequisite actions that must be finished before. Like, you need raw vegetables, bread, sauces, and to chop and slice the vegetables. Similarly, you need the ingredients to prepare sauces. <br>Similarly, to create your visualisation, you need to move your data from relational databases to a data warehouse.</p><p>To be able to create more refined and accurate ML models thanks to efficient, economical, and well-organised data pipelines because these models have been trained on whole datasets rather than just tiny samples. Since Hive, Presto, and Spark are all big data platforms that Airflow is natively built to operate with, it makes for an excellent framework for managing jobs that use any of these engines. Airflow is being used by businesses to orchestrate their ETL/ELT tasks more often.</p><h4>Unleashing Workflow Automation</h4><p>Let’s start with a few base concepts of Airflow!</p><h4>Airflow DAG</h4><p>Workflows in Airflow just python files that are described by DAGs (Directed Acyclic Graphs). Although it is advised to have one DAG per file, a single DAG file may include numerous DAG definitions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K39RTf9g18ZUJcX_LZDhFg.jpeg" /></figure><p>First, each DAG has a distinct dag_id that must be distinct throughout the whole Airflow deployment. In order to establish a DAG, we must also specify:</p><p>📍<strong>schedule_interval: </strong>This specifies the ideal time to run the DAG. It could be a cron expression(<strong>* * * * *</strong>) or a timedelta object, like timedelta(days=2). <br>If it is None, Airflow will not schedule the DAG; however, it may still be manually or externally activated.</p><p>📍<strong>start_date:</strong> a starting date (datetime object) from which the DAG will run. As a result, a DAG for earlier dates can be conducted. The days_ago function is frequently used to specify this number. The dag can still be manually activated if the date is in the future.</p><p>📍<strong>retries:</strong> It tells how many attempts should be made before giving up on an assignment</p><p>📍<strong>email_on_retry/email_on_failure : </strong>It can be set to <em>True</em> or <em>False</em> based on the need.</p><p>📍<strong>depends_on_past: </strong>When set to true, task instances will execute one after the other while depending on the schedule of the preceding task to complete. It is permitted to launch the start_date task instance.</p><p>We may begin adding jobs to our DAG once we have this baseline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fPd4_YN_qj4lLkacG3Td5w.jpeg" /></figure><p>Each job in an Airflow DAG is defined by the operator (we’ll go into more specifics shortly), and each task has a task_id that must be distinct from other tasks in the DAG. A collection of dependencies for each activity establishes how it interacts with other tasks. These consist of:</p><p>📌 Tasks that will be completed before are known as <strong><em>upstream</em></strong> tasks.<br>📌 Tasks that will be completed after a task are known as <strong><em>downstream</em></strong> tasks.</p><p>In our case, <strong><em>task_a</em></strong> is downstream of <strong><em>task_b</em></strong> and <strong><em>task_c</em></strong>. And <strong><em>task_a</em></strong> is upstream of both <strong><em>task_b</em></strong> and <strong><em>task_c</em></strong>, respectively. The <strong>&gt;&gt;</strong> operator, which is applicable to both individual tasks and collections of tasks (such as lists or sets), is a typical technique to describe a relationship between tasks.</p><p>This is how a graphical representation of this DAG looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3mw6YX5zbTvdX-47nb9gQ.png" /><figcaption>graph view of a DAG</figcaption></figure><h4>Task Instances</h4><p>The tasks that make up a DAG are instantiated into <a href="https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html">Task Instances</a> in a manner similar to how a DAG is created into a DAG Run each time it is executed.</p><p>A Task instance is a particular execution of a Task for a certain DAG (and hence for a distinct data period). They also serve as a representation of a Task with a state that indicates the stage of its lifespan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hsETE1-8jiR-1XgKwgJRkg.png" /><figcaption>state of a job</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OFi32SaSz2y20IODLzVNZA.jpeg" /><figcaption>task lifecycle</figcaption></figure><p>Ideally, a task should flow from none, to scheduled, to queued, to running and finally to success.</p><h3>Next Stop — Operators, Sensors, and Plugins!</h3><p>In conclusion, this blog has provided a comprehensive overview of airflow and its significance in modern data engineering workflows. We have explored the fundamental concepts, architecture, and key features of airflow, highlighting its ability to streamline and automate complex data pipelines.</p><p>As we delve deeper into the world of airflow, it becomes apparent that there are numerous components that contribute to its versatility and functionality. Operators, sensors, and plugins play pivotal roles in enhancing the capabilities of airflow, allowing for seamless integration with various systems, databases, and services.</p><p>In our next blog, we will take a closer look at <strong><em>operators</em></strong>, <strong><em>sensors</em></strong>, and <strong><em>plugins</em></strong>. We will explore their functionalities, use cases, and how they can be leveraged to orchestrate intricate data workflows. Whether you’re an airflow beginner or an experienced user, this detailed examination will provide valuable insights to help you optimise and customise your airflow setups.</p><h4>You may also like</h4><p>➙ <a href="https://airflow.apache.org/docs/apache-airflow/1.10.3/concepts.html">https://airflow.apache.org/docs/apache-airflow/1.10.3/concepts.html</a><br>➙ <a href="https://medium.com/@kausarbazla3/unlocking-the-power-of-elastic-search-apis-a-comprehensive-guide-96f30b29c99f">https://medium.com/@kausarbazla3/unlocking-the-power-of-elastic-search-apis-a-comprehensive-guide-96f30b29c99f</a><br>➙ <a href="https://medium.com/@kausarbazla3/mastering-elasticsearch-index-management-tips-tricks-c36a26916477"><em>Mastering Elastic Search Index Management : Tips &amp; Tricks</em></a><em><br></em>➙ <a href="https://medium.com/@kausarbazla3/elastic-search-101-6d39bb933664"><em>Elastic Search 101</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a94cd853862b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Power of Elastic Search APIs: A Comprehensive Guide]]></title>
            <link>https://medium.com/@kausarbazla/unlocking-the-power-of-elastic-search-apis-a-comprehensive-guide-96f30b29c99f?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/96f30b29c99f</guid>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Mon, 03 Apr 2023 11:09:15 GMT</pubDate>
            <atom:updated>2023-04-03T11:10:41.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbixvIvHT4mJph4E5WHplQ.png" /></figure><p>Welcome to my blog on Elastic Search REST APIs! <br>If you’re looking to learn more about Elastic Search and its capabilities, then you’ve come to the right place. In this blog, we’ll dive deep into the Elastic Search REST APIs and explore how they work, how to use them effectively, and some best practices for working with them. We’ll cover topics such as CRUD operations, search queries, aggregations, mapping, and more. So, let’s get started!</p><p>Elasticsearch’s robust REST API is one of its best features. There are several instances of using this API to interface with Elasticsearch, involving various businesses and use cases. It gives you many options for integrating, managing, and querying the indexed data. Elasticsearch provides a REST API, which is accessed by JSON over HTTP. <br>In this blog, we will be discussing the following key points as mentioned in the diagram, providing you with a comprehensive overview and practical insights to help you apply these concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoQmY9dnOF2adJ3mQKxEIQ.png" /></figure><h4><strong>1. DOCUMENT API</strong></h4><p>Elasticsearch provides single document APIs and multi-document APIs. As a part of this we will be exploring Index API, Delete API &amp; Update API.<br><strong>➾</strong> <strong>Index API : </strong>When a request is made to a given index with a specific mapping, the Index API helps to add or change the JSON document within that index.</p><pre>Request:<br>POST student/_doc/<br>{<br>  &quot;student&quot;: &quot;shenoy&quot;,<br>  &quot;post_date&quot;: &quot;2023-01-01T14:12:12&quot;,<br>  &quot;message&quot;: &quot;adding,don&#39;t know why!&quot;<br>}<br><br>Response:<br>{<br>    &quot;_index&quot; : &quot;student&quot;,<br>    &quot;_type&quot; : &quot;_doc&quot;,<br>    &quot;_id&quot; : &quot;5&quot;,<br>    &quot;_version&quot; : 1,<br>    &quot;result&quot; : &quot;created&quot;,<br>    &quot;_shards&quot; : {<br>       &quot;total&quot; : 2,<br>       &quot;successful&quot; : 1,<br>       &quot;failed&quot; : 0<br>    },<br>    &quot;_seq_no&quot; : 2,<br>    &quot;_primary_term&quot; : 1<br> }</pre><h4>Effortless Indexing : Streamlining the Process with Automatic Index Creation</h4><p>When a request is made to add a JSON object to a certain index, this API will automatically build that index and the underlying mapping for that specific JSON object if that index does not already exist. By setting the following options in the <em>elasticsearch.yml</em> file to false, this capability can be turned off.</p><pre>action.auto_create_index:false<br>index.mapper.dynamic:false</pre><p><strong>➾</strong> <strong>GET API</strong> : The specified JSON document is retrieved from an index using the GET API. You can retrieve a page from a specific index using GET, along with its source or stored attributes. To confirm the existence of a document, use HEAD. The <em>_source</em> resource allows you to access simply the document source or to confirm that it is actually there.</p><pre>GET index_1/_doc/0?_source=false</pre><p>If you’re looking to implement routing and versioning functionalities, be sure to check out the elastic <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">documentation</a>.<br><strong>➾</strong> <strong>DELETE API</strong> : By making an HTTP DELETE request to Elasticsearch, you can remove a specific index, mapping, or document.</p><pre>DELETE index_1/_doc/4</pre><p>On hitting the above API, we get the following result :</p><pre>{<br>   &quot;found&quot;:true, &quot;_index&quot;:&quot;index_1&quot;, &quot;_type&quot;:&quot;index&quot;, &quot;_id&quot;:&quot;4&quot;, &quot;_version&quot;:2,<br>   &quot;_shards&quot;:{&quot;total&quot;:2, &quot;successful&quot;:1, &quot;failed&quot;:0}<br>}</pre><p><strong>➾</strong> <strong>UPDATE API : </strong>Versioning is utilised to ensure that no modifications have taken place between the get and re-index operations, which are carried out using script. For instance, you can use script to update the desired details</p><pre>POST students/_update/4<br>{<br>   &quot;script&quot; : {<br>      &quot;source&quot;: &quot;ctx._source.name = &#39;Shabby&#39;&quot;,<br>      &quot;lang&quot;: &quot;painless&quot;,<br>      &quot;params&quot; : {<br>         &quot;name&quot; : &quot;shab&quot;<br>      }<br>   }<br> }</pre><p>You can check the update by sending get request to the updated document.<br>The contents of the upsert element are inserted as a new document if one doesn’t already exist. The script runs successfully if the document is present. <br>You can set doc as upsert to true to use the contents of doc as the upsert value rather than sending a partial doc along with an upsert doc.</p><pre>POST index_1/_update/1<br>{<br>  &quot;doc&quot;: {<br>    &quot;name&quot;: &quot;new_name&quot;<br>  },<br>  &quot;doc_as_upsert&quot;: true<br>}</pre><h4>2. SEARCH API</h4><p>Elasticsearch content searches are done using <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-your-data.html">Search API</a>. A user can conduct a search by either sending a query in the message body of a post request or by sending a get request with a query string as a parameter. <br><strong>Multi-Index : </strong>We can use Elasticsearch to search for documents that are present in all indices or just a few particular indices. For instance, we can follow these steps if we want to search all documents containing the word <strong><em>Sharma</em></strong> in their names.</p><pre>GET /_all/_search?q=name:Sharma </pre><h4>3. INDEX API</h4><p>You can make an index with the use of this API. An index can either be established beforehand or automatically produced when a user passes JSON objects to any index. You only need to send a PUT request containing settings, mappings, and aliases — or simply a straightforward request without a body — to establish an index.</p><pre>PUT Students</pre><pre>{<br>   &quot;acknowledged&quot; : true,<br>   &quot;shards_acknowledged&quot; : true,<br>   &quot;index&quot; : &quot;Students&quot;<br>}</pre><p><strong>➾</strong> <strong>DELETE INDEX :</strong> With this API, you can remove any index. Simply pass a delete request together with the name of that specific Index (Just using <strong>_all</strong> or <strong>*</strong> will remove all indices)</p><pre>DELETE /Students<br>       OR<br>DELETE /_all<br>       OR<br>DELETE /Students*</pre><p><strong>➾</strong> <strong>INDEX STATS :</strong> You can extract statistics about a specific index with the help of this API. Simply include the index URL and the _stats keyword in the body of a get request.</p><pre>REQUEST:<br>GET /_stats<br><br>RESPONSE:<br>   &quot;request_cache&quot; : {<br>      &quot;memory_size_in_bytes&quot; : 820,<br>      &quot;evictions&quot; : 0,<br>      &quot;hit_count&quot; : 1152,<br>      &quot;miss_count&quot; : 4<br>   },<br>   &quot;recovery&quot; : {<br>      &quot;current_as_source&quot; : 0,<br>      &quot;current_as_target&quot; : 0,<br>      &quot;throttle_time_in_millis&quot; : 0<br>   }</pre><h4>4. MAPPING API</h4><p>The layout of the documents kept in an index is known as mapping. It specifies the fields’ formats, data types (such as geo point or string), and rules that govern how dynamically added fields are mapped.</p><pre>REQUEST:<br>PUT Students<br>{<br>   &quot;mappings&quot;:{<br>      &quot;properties&quot;:{<br>         &quot;name&quot;: { &quot;type&quot;:&quot;text&quot;}, &quot;date&quot;:{ &quot;type&quot;:&quot;date&quot;},<br>         &quot;Class&quot;:{ &quot;type&quot;:&quot;text&quot;}, &quot;marks&quot;:{ &quot;type&quot;:&quot;double&quot;}<br>      }<br>   }<br> }<br>RESPONSE:<br>{<br>   &quot;acknowledged&quot; : true,<br>   &quot;shards_acknowledged&quot; : true,<br>   &quot;index&quot; : &quot;Students&quot;<br>}</pre><p>Then, based on the matching criterion, you can use <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html">dynamic templates</a> to construct unique mappings that can be applied to dynamically added fields.</p><h4>5. CLUSTER API</h4><p>The cluster API is used to modify the nodes in the cluster and obtain information about them. We must provide the <em>node name</em>, <em>address</em>, or <em>_local</em> when calling this API.<br><strong><em>NODE SPECIFICATIONS<br> </em></strong>👉 _all, to add all nodes to the subset<br>👉 _local, to add the local node to the subset<br>👉 node id or name, to add this node to the subset<br>👉 _master, to add the currently-elected master node to the subset<br>👉 All master-eligible nodes, all data nodes, all ingest nodes, all voting-only nodes, all machine learning nodes, and all coordinating-only nodes are added to the subset, respectively, by the values <strong><em>master:true</em></strong>, <strong><em>data:true</em></strong>, <strong><em>ingest:true</em></strong>, <strong><em>voting only:true</em></strong>, <strong><em>ml:true</em></strong>, or <strong><em>coordinating only:true</em></strong>.<br>👉 All master-eligible nodes, all data nodes, all ingest nodes, all voting-only nodes, all machine learning nodes, and all coordinating-only nodes are each removed from the subset when one of the following values is specified; <strong><em>master:false</em></strong>, <strong><em>data:false</em></strong>, <strong><em>ingest:false</em></strong>, <strong><em>voting only:true</em></strong>, <strong><em>ml:false</em></strong>, or <strong><em>coordinating only:false</em></strong>.</p><h4>6. QUERY DSL</h4><p>Elasticsearch uses JSON-based querying to carry out its searching. Two clauses — leaf query clauses and compound query clauses — make up a <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html">DSL query</a>.<br><strong>Leaf Query Clause</strong> : Leaf query clauses, like match, phrase, or range inquiries, search for a specific value in a specific pitch.</p><p><strong>Compound Query Clause :</strong> Whether combining numerous queries logically (as in the bool or dis max query) or changing their behaviour (as in the constant score query), compound query clauses wrap other leaf or compound queries.<br>Elasticsearch can handle a multitude of distinct types of queries. A query begins with a query key word and then includes conditions and filters as JSON objects inside. The various query types have been detailed below.</p><p><strong>➾ Match All Query</strong></p><p>This is the simplest that returns all of its content with a score of 1.0 for each object.<br>The inverse of the match_all query, is match_none which matches no documents.</p><pre>POST /students/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;match_all&quot;:{}<br>   }<br>}<br>       OR<br>POST /students/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;match_none&quot;:{}<br>   }<br>}</pre><p><strong>➾ Full Text Query<br></strong>With these queries, you can search a substantial body of text. This query operates in accordance with the analyzer connected to that specific index or document. We will go over the various kinds of full text queries in this section.</p><p>📍<strong><em>Match Query : </em></strong>This query compares the values of one or more fields to a text or phrase.</p><pre>POST /students*/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;match&quot; : {<br>         &quot;marks&quot;:&quot;60&quot;<br>      }<br>   }<br>}</pre><p>📍<strong><em>Multi Match Query : </em></strong>This search identifies text or phrases that appear in multiple fields.</p><pre>POST /students*/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;multi_match&quot; : {<br>         &quot;query&quot;: &quot;Banaras&quot;,<br>         &quot;fields&quot;: [ &quot;city&quot;, &quot;state&quot; ]<br>      }<br>   }<br>}</pre><p>You will see the document when you run this search if Banaras is listed in either the city or state fields.<br>📍<strong><em>String Query : </em></strong>This query makes use of the <em>query_string</em> keyword and query parser. on hitting this query, you will get the occurance of this string in your Elastic Index.</p><pre>POST /students*/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;query_string&quot;:{<br>         &quot;query&quot;:&quot;functional&quot;<br>      }<br>   }<br>}  </pre><p>📍<strong><em>Term Query : </em></strong>The majority of these queries deal with structured data like integers, dates, and enums.</p><pre>POST /students*/_search<br>{<br>   &quot;query&quot;:{<br>      &quot;term&quot;:{&quot;zip&quot;:&quot;206001&quot;}<br>   }<br>}</pre><p>📍<strong><em>Range Query : </em></strong>This search is utilized to locate objects that possess values within a specified range. To achieve this, we utilize operators including:</p><p>☞ <strong><em>gte</em></strong><em> :</em> stands for greater than or equal to<br>☞ <strong><em>gt : </em></strong>stands for greater than<br>☞ <strong><em>lte :</em></strong> stands for less than or equal to<br>☞ <strong><em>lt :</em></strong> stands for less than</p><pre>GET /students*/_count<br>{<br>  &quot;query&quot;: {<br>            &quot;bool&quot;: {<br>                &quot;filter&quot;: {<br>                    &quot;range&quot;: {<br>                      &quot;date&quot; : {<br>                        &quot;gte&quot;: &quot;2023-01-15&quot;,<br>                        &quot;lt&quot; : &quot;2023-01-16&quot;<br>                      }<br>                    }<br>                }<br>              }<br>            }<br>        }</pre><p>📍<strong><em>Compound Query : </em></strong>These queries are a group of various searches that have been combined utilising Boolean operators such as <em>and</em>, <em>or</em>, <em>not</em>, <em>or</em> for various indices, containing function calls, etc.</p><pre>POST /students/_search<br>{<br>   &quot;query&quot;: {<br>      &quot;bool&quot; : {<br>         &quot;must&quot; : {<br>            &quot;term&quot; : { &quot;state&quot; : &quot;UP&quot; }<br>         },<br>         &quot;filter&quot;: {<br>            &quot;term&quot; : { &quot;rating&quot; : &quot;5&quot; }<br>         },<br>         &quot;minimum_should_match&quot; : 1,<br>         &quot;boost&quot; : 1.0<br>      }<br>   }<br>}</pre><p>📍<strong><em>Geo Query : </em></strong>This query revolves around <em>geo locations</em> and <em>geo points</em>. These searches assist in locating schools or any other nearby geographic item. You need to use geo point data type.</p><h4>WRAPPING UP…</h4><p>To conclude, Elastic search provides an extensive set of REST APIs that can be used to interact with the search engine. These APIs enable developers to create, read, update, and delete data in Elastic search. With the help of Elastic search’s powerful search capabilities, developers can create high-performance applications that can search through large amounts of data in real-time.</p><p>In this blog, we have covered the basics of Elastic search REST APIs, including how to use them to create, read, update, and delete documents in an index. We have also looked at some common scenarios where REST APIs can be used to interact with Elastic search, such as performing searches, mappings etc.</p><p>If you are interested in learning more about Elastic search, please refer to my previous Introductory blogs on the Elastic Search where I have covered a wide range of Elastic search topics and provide a great starting point for developers looking to get started with this powerful search engine.</p><p>Reference Links:<br>🔗 <a href="https://medium.com/@kausarbazla3/elastic-search-101-6d39bb933664"><em>Elastic Search 101</em></a><em><br></em>🔗 <a href="https://medium.com/@kausarbazla3/mastering-elasticsearch-index-management-tips-tricks-c36a26916477"><em>Mastering Elastic Search Index Management : Tips &amp; Tricks</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96f30b29c99f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Elasticsearch Index Management: Tips & Tricks]]></title>
            <link>https://medium.com/@kausarbazla/mastering-elasticsearch-index-management-tips-tricks-c36a26916477?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/c36a26916477</guid>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 10:59:51 GMT</pubDate>
            <atom:updated>2023-02-16T10:59:51.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-JnWFvhYSx-MmCJ1XiL0A.gif" /></figure><p><a href="https://medium.com/@kausarbazla3/elastic-search-101-6d39bb933664">Elasticsearch</a> is a potent distributed search engine that has evolved over time into a more versatile NoSQL analytics and storage service. Performance and dependability of an Elasticsearch cluster are significantly impacted by how data is distributed between nodes. This part of using Elasticsearch is also one of the more challenging aspects for users. An inaccurate or non-optimised configuration can make a huge difference.</p><p>The indexing and management of indices in <a href="https://medium.com/@kausarbazla3/elastic-search-101-6d39bb933664">Elasticsearch</a> is one area that demands specific attention.</p><h3>Structuring data within Elasticsearch indices</h3><p>The majority of your focus while administering an Elasticsearch index is on maintaining stability and performance. The overall usefulness of the system, however, is also greatly influenced by the structure of the data that is actually used to create these indices. This structure has an effect on the precision and adaptability of search queries across data that may potentially come from many data sources, which has an effect on how you analyse and visualise your data as a result.</p><p>In fact, the advice to build mappings for indices has been around for a while. Even though Elasticsearch can infer data types from the input data it receives, this inference is based on a small sample of the entire data set and might not be accurate. Data type conflicts in an index can be avoided by explicitly constructing a mapping.</p><h3>Optimisation for time series data</h3><p>Elasticsearch requires the management of enormous amounts of data over extended periods of time in order to store and analyse time series data, such as application logs etc.</p><h4>Elasticsearch Rollover</h4><p>Time series data is frequently distributed among several indices. Having a different index for arbitrary lengths of time, such as one index per day, is an easy approach to accomplish this. Utilising the <a href="https://www.elastic.co/blog/managing-time-based-indices-efficiently">Rollover API</a> is an alternative strategy since it can automatically construct a new index when the primary one is too large, too old, or contains too many entries.</p><h4>Elasticsearch Shrink</h4><p>There are various things you can do to make older indices utilise fewer resources when their data becomes less important, allowing the more active indices to have access to more resources. One of possibilities is to flatten the index to a single primary shard using the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-shrink.html">Shrink</a> API. Although numerous shards are typically a desirable thing, they can be a burden for older indices that only seem to get requests. Naturally, a lot will depend on the way your data is organised.</p><h4>Frozen Indices</h4><p>It seems fair to totally free up the RAM that extremely old indices use since they are rarely used. You may do just that thanks to the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen-indices.html">Freeze API</a>, which is available in Elasticsearch 6.6 and later. When an index is frozen, its resources are no longer retained in an active state, and it becomes read-only.</p><h4>Index Refresh</h4><p>When a document index request is made, the translog is updated and an in-memory buffer is written to. The document will now be searchable when the next index refresh, which by default happens once per second, creates a new in-memory segment from the content of the in-memory buffer. The in-memory buffer will then be cleared. A collection of segments from refreshes is built up over time. To make effective use of resources, portions are then gradually blended together in the background (each segment uses file handles, memory, and CPU). Because index refresh is an expensive operation, it is done periodically (by default) rather than following each indexing action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTrr3MHqnlXqmAp3nCrsww.png" /></figure><h4><strong>Index lifecycle management : </strong>Hot-Warm-Cold Architecture</h4><p>ILM, a component of Elasticsearch, is made to make managing your indexes easier.</p><p>Hot-warm-cold Architectures for time series data, like logging or metrics, are prevalent. Consider Elasticsearch as an example, which is used to combine log files from various systems. The most frequently searched logs are from this week, and today’s logs are actively being indexed (hot). The logs from last week may be searched, but not as thoroughly as the logs from this week (warm). The logs from the previous month may or may not be frequently examined, but they are still useful to maintain on side (cold).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-NV8olDJY-ETmS1Bmnxsw.jpeg" /></figure><p>Four hot nodes, four warm nodes, and four cold nodes make up this cluster of 12 nodes in the aforementioned illustration. To implement hot-warm-cold with ILM, you don’t need 12 nodes, but you will need at least 2. Your needs will determine the size of your cluster. The cold nodes are optional and merely add one more level to your data placement model. You can specify which nodes are hot, warm, or cold in Elasticsearch. With ILM, you may specify when to switch between phases and what to do with the index when doing so.</p><h4>Making an ILM policy within Kibana</h4><p>Don’t enjoy writing a lot of JSON? (Neither do I.) Let’s build the policy using the Kibana UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZLWU1RKhfmf_IgwYQegSg.png" /></figure><p>The Beats and Logstash indexes must now be linked to the new hot-warm-cold-delete-60days policy in order for them to write to the hot data nodes. We will utilise multiple template matching to add the policy and allocation rules for the index patterns you wish to apply the ILM policy to since Beats and Logstash both (by default) manage their own templates. You must be aware of the index patterns you wish to match on since this template matches the Beats and Logstash index patterns. Here, we utilise logstash-, metricbeat-, and filebeat-*; feel free to add more, provided that Beats and Logstash are configured with ILM support enabled. For data producers who don’t support ILM, you can add index patterns here.</p><blockquote>PUT _template/hot-warm-cold-delete-60days-template<br>{<br> “order”: 10,<br> “index_patterns”: [“logstash-*”, “metricbeat-*”, “filebeat-*”],<br> “settings”:</blockquote><blockquote>{<br> “index.routing.allocation.require.data”: “hot”,<br> “index.lifecycle.name”: “hot-warm-cold-delete-60days”<br> }<br>}</blockquote><h3>Digest</h3><p>Your Elasticsearch cluster’s stability and performance are strongly impacted by how properly you set up index sharding and replication. You can manage your Elasticsearch indices with the help of the aforementioned functionalities. The fact that this activity involves knowledge of both Elasticsearch’s data model and the particular data set being indexed makes it one of the more difficult aspects of using Elasticsearch.</p><p>The Rollover and Shrink APIs let you handle simple index overflow and improve indices for time-series data. You may manage another category of older indices thanks to the recently added feature to freeze indices. To maximise the use of the data in an Elasticsearch cluster, mappings for indexed data and field mappings to the Elastic Common Schema can be created.</p><p>Last but not least, the ILM functionality, which is a more recent development, enables complete automation of index lifetime transitions. As indices get older, they can be changed and redistributed to use less resources, which frees up more resources for the more active indexes.</p><p>Happy Searching!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c36a26916477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elastic Search 101]]></title>
            <link>https://medium.com/@kausarbazla/elastic-search-101-6d39bb933664?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d39bb933664</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[elastic-stack]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 09:47:41 GMT</pubDate>
            <atom:updated>2022-07-07T13:32:12.679Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2sz6aCSCor_Segc8sRoC-w.gif" /></figure><p>We can utilize the Elastic Stack to reveal the hidden potential of its data to gain insights about customer patterns, track performance metrics, and user analytics — all in near real-time.</p><p>With countless business-critical text search and analytics use cases that utilize Elasticsearch as the backbone, we create dynamic APIs on top of it to allow easy searching.</p><h4>From Compass to ElasticSearch</h4><p>So, how did Elastic co-founder Shay Bannon’s modest search engine for his wife’s cooking recipes evolve to become the most popular enterprise search engine today? So let’s start with an overview of Elasticsearch, including what it is, how it works, and how it’s used. Let’s get started.</p><h4>What is an ElasticSearch?</h4><p>What is an Elasticsearch? Some people may say that ElasticSearch is “an index,” “a search engine,” “an analytics database,” “a big data solution, Depending on how acquainted you are with this technology.</p><ul><li>ElasticSearch is a scalable search solution that provides near real-time search, and multi-tenancy support. It collects unstructured data from a variety of sources, stores and indexes it using user-defined mapping (which can also be derived automatically from data), and makes it searchable.</li><li>Its networked architecture allows it to search and analyze massive amounts of data in real time. It allows you to start small and build up to hundreds of machines.</li><li>Elasticsearch is frequently used to store data that must be sliced and diced, grouped by different dimensions, and so on. ElasticSearch for metrics, logs, traces etc., are examples of such analytical use cases.</li></ul><h4>Why ElasticSearch?</h4><p>ElasticSearch and the “Elastic Stack” ecosystem of components have been used for an increasing range of use cases over the years, ranging from simple search on a website or document to collecting and analyzing log data, to a business intelligence tool for data analysis and visualization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HPN5kDwZ4oaYEZECedHOuw.png" /><figcaption>Features Of Elastic Search</figcaption></figure><h4>How ElasticSearch works</h4><p>Let’s go through some basic notions about how Elasticsearch organizes data and its backend components to get a better understanding of how it works.</p><ol><li>Document : Elasticsearch’s core and basic unit of information entity is the document, which is represented in JSON format. Documents can be archived and searched. There are one or more documents in an index, and each document has one or more fields.Each document has a distinct ID and a data type that identifies what type of object it is.</li><li>Index : An index is a collection of documents with a common structure that is used to store and retrieve documents. An index is given a name that is used to refer to it while performing indexing, searching, updating, and deleting operations on the documents included within it.</li><li>Inverted Index : The mapping from content, such as words or numbers, to their places in a document or series of documents is stored in an Inverted Index. In short, it is a data structure that resembles a hashmap and guides you from a word to a document.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNCVb_dpPKb39LHOU4o2ww.png" /><figcaption>Visual representation of an Inverted Index</figcaption></figure><p>Instead of storing strings directly, an inverted index breaks down each document into individual search phrases (i.e., each word) and then associates each search term with the documents in which it appears</p><p>4. Cluster : The distribution of tasks, such as searching and indexing, among all cluster nodes is what gives an Elasticsearch cluster its functionality. A cluster is a group of one or more computers that collectively store all of your data and enable federated indexing and search.</p><p>5. Node : A single server that is a component of a cluster and stores our data as well as participating in the cluster’s indexing and search functions is called as a node. Elasticsearch nodes can be set up in multiple of ways:</p><ul><li>Master Node : Master node manages the Elasticsearch cluster and is in charge of all cluster-wide actions like adding/removing nodes and creating/deleting an index.</li><li>Data Node : Data node does data-related tasks, such as search and aggregation, and stores data.</li><li>Client Node : Customer node forwards requests for the cluster to the master node and requests for data to the data nodes.</li></ul><p>6. Shards &amp; Replicas : Elasticsearch offers the ability to break your index into numerous sections known as shards. Simply provide the desired number of shards when creating an index. Each shard functions as a complete, independent “index” in and of itself that can be hosted on any cluster node.</p><p>Replica shards, often known as “replicas”, are copies of your index’s shards that Elasticsearch lets you create in any number. A replica shard is essentially a duplicate of a primary shard. Each primary shard in an index contains one document per shard. Replicas offer redundant copies of your data to safeguard against hardware failure and expand capacity to handle read requests like indexing and retrieval or search.</p><h4>The Elastic Stack</h4><p>Elastic Stack, a collection of open-source technologies for data intake, enrichment, storage, analysis, and visualisation, is anchored by Elasticsearch. After its constituents Elasticsearch, Logstash, and Kibana, it is usually referred to as the “ELK” stack, which currently now incorporates Beats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sRoo80QkgvZ3oCIme_UvOg.png" /></figure><h4>Kibana</h4><p>Kibana is a data management and visualisation tool for Elasticsearch that offers real-time maps, pie charts, line graphs, and histograms. By starting with a single query, you may decide how to structure your data and see where the interactive visualisation will take you. It can be used to explore the Elastic Stack and visualise your Elasticsearch data.</p><h4>Logstash</h4><p>An open-source server-side data processing pipeline called Logstash ingests data from numerous sources at once, alters it, and then transform it to a collection. Data is collected, processed, and sent to Elasticsearch using Logstash.</p><p>For instance, Logstash enables you to connect numerous systems, such as web servers, databases, Amazon services, etc. and publish data to wherever it needs to go in a continuous streaming fashion because data is frequently dispersed across different systems in different formats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67aiSzyMvMeObChi9NMN_g.png" /><figcaption>ELK Stack Architecture</figcaption></figure><h4>Beats</h4><p>To deliver data from hundreds or thousands of computers and systems to Logstash or Elasticsearch, a group of lightweight, specialised data shipping agents called Beats is leveraged. For instance, Filebeat can be installed on your server and watch over log files as they arrive, process them, and import them into Elasticsearch in near-real time.</p><h4>What are some uses of Elastic Search?</h4><p>We can better grasp why and how Elasticsearch can be utilised for a variety of use cases now that we have a general understanding of what it is, the logical concepts underlying it, and its design. In the sections below, we’ll look at some of Elasticsearch’s most common use cases and give examples of how businesses are currently utilising it.</p><blockquote>Primary Use cases</blockquote><ol><li>Application Search : for software programmes that significantly rely on search platforms to obtain, retrieve, and report data.</li><li>Website Search : Websites which store a lot of content find Elasticsearch a very useful tool for effective and accurate searches.</li><li>Enterprise Search : Elasticsearch is an extremely beneficial for efficient and precise searches on websites that store a lot of content. It’s hardly surprising that Elasticsearch is making progress in the field of site searches.</li><li>Logging &amp; Log Analytics : Elasticsearch is frequently used to ingest and analyse log data in a scalable, in near-real-time.</li><li>Security Analytics : The ELK stack may be used to examine access logs and other logs related to system security, giving you a more complete picture of what’s happening across your systems in real-time.</li><li>Business Analytics : The ELK Stack is a great alternative as a business analytics solution because it has many built-in functionalities available. The implementation of this product, however, comes with a significant learning curve in most firms.</li></ol><h4>Summary</h4><p>What precisely is Elasticsearch? We made an effort to respond to that question in this post by examining what it is, how it functions, and how it is utilised, but we have only just begun to discover everything there is to know about it. Nevertheless, based on what we’ve discussed so far, we can briefly state what an Elasticsearch is, at its core, a search engine. Its underlying architecture and components make it fast and scalable, and it sits at the centre of an ecosystem of complementary tools that, when used together, can be used for a variety of uses cases, including search, analytics, and data processing and storage. If you’re interested in learning more about Elasticsearch and trying it out for yourself so stay tuned for part two, where we’ll dive deeper into Elastic Search.</p><p>Happy searching!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d39bb933664" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Spark 101]]></title>
            <link>https://medium.com/@kausarbazla/apache-spark-101-a399137bb4b2?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/a399137bb4b2</guid>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[pyspark]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 05:39:56 GMT</pubDate>
            <atom:updated>2021-12-06T05:39:56.029Z</atom:updated>
            <content:encoded><![CDATA[<p>Apache Spark : a general-purpose distributed data processing engine that imports large amounts of data, performs calculations on it in a distributed environment, and then stores it for future processing to meet business requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVUhHeeDQPTtdzqLQu_ZpA.jpeg" /></figure><h3><strong>The Why &amp; How Of Spark ?</strong></h3><p>Hadoop is widely used in industries to examine large data volumes. The reason for this is that the Hadoop framework is built on a basic programming paradigm (Map Reduce), which is a scalable, flexible, fault-tolerant, and cost-effective computing solution. The major goal here is to maintain speed in processing massive datasets in terms of query response time and program execution time.</p><p><a href="https://github.com/bazlakausar/InstallingApacheSpark">Apache Spark</a> is a Hadoop Map Reduce based framework that extends the Map Reduce concept to allow for other sorts of computations, such as interactive queries and stream processing. The most appealing feature of Apache Spark is its compatibility with Hadoop. As a result, this is an incredibly potent combination of technologies. Using Spark and Hadoop together allows us to use Spark’s processing to take use of the advantages of Hadoop’s HDFS and YARN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8d0UYKbXOhSOZdy6736guw.jpeg" /><figcaption>Hadoop vs. Apache Spark</figcaption></figure><h3><strong>Architecture</strong></h3><p>Spark may operate in a standalone cluster mode, using only the Apache Spark framework and a JVM on each server in the cluster. However, it’s more probable that you’ll want to use a more powerful resource or cluster management solution to handle your on-demand worker allocation. Apache Spark can operate on Apache Mesos, Kubernetes, and Docker Swarm.</p><p>At its most basic level, an <a href="https://github.com/bazlakausar/InstallingApacheSpark">Apache Spark</a> application is made up of two parts: a driver that turns user code into many tasks that can be spread among worker nodes, and executors that operate on those nodes and carry out the tasks given to them. To arbitrate between the two, some sort of cluster manager is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0y2hrp3zRblcsbwpbpeokA.jpeg" /></figure><h3><strong>Apache Spark-RDD</strong></h3><p>Spark uses a fundamental data structure known as <a href="https://github.com/bazlakausar/Introduction-to-PySpark">RDD</a> (Resilient Distributed Datasets). RDDs are distributed collections of items that are immutable, fault-tolerant, and may be acted on in parallel. They are formed by transforming existing RDDs or importing a dataset from a stable storage system such as HDFS or HBase. RDDs are divided into divisions and can be run on various cluster nodes.</p><p>Datasets are divided into two categories:</p><ul><li>Parallelized collections: These collections are designed to run in parallel.</li><li>Hadoop datasets: These run operations on HDFS or other storage systems’ file record systems.</li></ul><p><strong><em>To accomplish quicker and more efficient Map Reduce processes, </em></strong><a href="https://github.com/bazlakausar/InstallingApacheSpark"><strong><em>Apache Spark</em></strong></a><strong><em> makes use of the </em></strong><a href="https://github.com/bazlakausar/Introduction-to-PySpark"><strong><em>RDD</em></strong></a><strong><em> paradigm</em>.</strong></p><h3><strong>Job Execution In Spark</strong></h3><p>The first step is to use an interpreter to interpret the code (When you use Scala code, it is interpreted by the Scala interpreter). When the code is entered into the Spark console, Spark constructs an operator graph. The operator graph is sent to the DAG Scheduler when the action is called on Spark RDD (Direct Acyclic Graph (DAG) is a graph with finite vertices and edges. The edges indicate the operations to be done sequentially on RDDs, whereas the vertices represent RDDs. The DAG is then sent to the DAG Scheduler, which divides the graphs into stages of jobs depending on the data transformations). The operator graph is sent to the DAG Scheduler when the action is performed on Spark RDD.</p><p>The DAG Scheduler divides the operators into job phases. The stage entails performing comprehensive, step-by-step operations on the input data. After that, the operators are piped together. The stages are then handed to the Job Scheduler, which launches the task via the cluster manager, allowing it to function independently of the other stages. The task is then subsequently carried out by the worker nodes.</p><p>The process diagram below illustrates how DAG works in Spark:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xry9dvZb6XpXYpZpscquTw.jpeg" /></figure><h3>Data Frames in Spark</h3><p>To leverage the power of distributed processing concept of Data Frame comes into picture as an extension to the existing RDD API. A <a href="https://github.com/bazlakausar/Introduction-to-PySpark">Data Fram</a>e in Spark is a distributed collection of data with named columns. It’s similar in principle to a table in a relational database, but with more advanced optimizations. Data Frames may be built from a variety of sources, including structured data files, Hive tables, external databases, and existing RDDs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUtq0ChQmkN8vQ9XJW27dw.jpeg" /></figure><h4>Spark Languages</h4><p>Scala is the primary language for interfacing with the Spark Core engine, and it was used to create Spark. Spark includes API connectors for Java and Python right out of the box. Python is popular among users because it is easier and more suited to data analysis.<br><a href="https://github.com/bazlakausar/Introduction-to-PySpark">PySpark</a> library can be used to execute Python applications that construct Data Frames and other similar concepts.</p><h3>And That’s it!</h3><p>Congratulations! You have successfully made it, now you know what spark is, its architecture, the modules it provides, job execution, how to construct a data frame, and other PySpark concepts it offers. Not to mention the fact that you’ve set yourself up to learn a lot more about Spark. There’s still a lot to learn, so stay tuned for part two, where we’ll dive deeper into Spark Streaming.</p><blockquote><strong>You may also be interested in</strong></blockquote><ol><li><a href="https://github.com/bazlakausar/InstallingApacheSpark">Installing Apache Spar</a>k</li><li><a href="https://github.com/bazlakausar/Introduction-to-PySpark">Getting started with PySpark</a></li><li><a href="https://github.com/bazlakausar/Introduction-to-PySpark">Try creating your first Data Frame and RDD using PySpark</a></li><li><a href="https://github.com/bazlakausar/Getting-Started-With-RabbitMQ">Getting started with RabbitMQ</a></li><li><a href="https://medium.com/@kausarbazla3/growing-a-farm-of-rabbits-managing-message-flow-scalability-communication-across-multiple-399c8c86dae1">Introduction to Message Queuing</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a399137bb4b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Want the most powerful blend of power, performance, solutions, and support: Try Jetty!]]></title>
            <link>https://medium.com/@kausarbazla/want-the-most-powerful-blend-of-power-performance-solutions-and-support-try-jetty-51fae06028f5?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/51fae06028f5</guid>
            <category><![CDATA[jetty]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[web-server]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Thu, 18 Nov 2021 11:49:00 GMT</pubDate>
            <atom:updated>2021-11-18T11:49:00.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you require scalable performance in the face of realistic loads of concurrent connections? If you require good outcomes with thousands of HTTP connections and hundreds of WebSocket connections at the same time, Jetty has you covered!</p><blockquote>Jetty is a Java-based Web server and Servlet container that is widely used for machine-to-machine communication, usually within larger software frameworks.</blockquote><p>Devices, tools, frameworks, application servers, and clusters can all benefit from it. Jetty was introduced in 1994 and has undergone substantial growth and improvement over the last 20 years as technology has evolved.</p><p>Jetty offers both developers and administrators to <a href="https://github.com/bazlakausar/Deploying-Web-Applications-in-Jetty">deploy</a> it without worrying about unnecessary overhead or memory utilization. Its availability as a standard distribution, as well as its ability to be embedded within existing Java code, allows developers to create only the parts of Jetty that they require.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*9Kn-8w-DMkNelB8cjYv3aQ.jpeg" /></figure><h3>How does Jetty Server work?</h3><p>Jetty is used for a number of purposes, ranging from local development to business <a href="https://github.com/bazlakausar/Deploying-Web-Applications-in-Jetty">deployment</a>. It has the following core components:</p><ul><li>HTTP Server</li><li>Servlet Container</li><li>HTTP Client</li></ul><p>Jetty can run as a <a href="https://github.com/bazlakausar/getting_started_with_JettyServer">stand-alone server</a> and even be integrated into an existing application. For more detailed information about the Jetty start mechanism refer to the <a href="https://github.com/bazlakausar/getting_started_with_JettyServer">GitHub</a> documentation.</p><p>The Jetty server uses one or more adapters to listen on one or more network ports. HTTP requests for specified URLs are sent by clients. The HTTP requests arrive at the connectors through the network; the Jetty server processes them and routes them to the appropriate web application depending on their URLs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2FPRTvmufXX6_zHROL1gOg.jpeg" /><figcaption>Architecture Overview</figcaption></figure><p>Jetty is a <a href="https://github.com/bazlakausar/getting_started_with_JettyServer">standalone server</a> made up of Java components that are constructed, configured, and started to provide numerous functionalities.The <a href="https://github.com/bazlakausar/getting_started_with_JettyServer">Jetty standalone server</a> is based on three major concepts:</p><ul><li>The Jetty module system, which allows you to add Jetty functionalities to your application.</li><li>The $JETTY BASE directory, which allows you to specify which Jetty modules you want to enable, the properties of each enabled module, and thus the features you require for your web applications; and</li><li>The Jetty start mechanism, which launches a Java Virtual Machine that runs Jetty according to the configuration you specify.</li></ul><h3>Jetty Modules</h3><p>Jetty modules allow you to perform what you can do in Java code to assemble Jetty components. A Jetty module is nothing more than Jetty components put together in a declarative way using configuration files, just like you would with Java APIs.</p><h3>Why Jetty ?</h3><p>Jetty is a small, free server with a small memory footprint that excels at scalability, allowing development teams to scale their applications throughout the software development lifecycle. As a result, Jetty is preferred by teams who want to move development to the cloud or use a healthy amount of micro-services without modifying their application architecture during production deployment.</p><p>Also Jetty is considered cloud friendly because of its tiny memory footprint, which allows you to operate more instances of the server on virtual hardware, which is often memory constrained &amp; also lowers unwanted overhead on an application.</p><p>Jetty is now often used across a variety of platforms for both development and production. Applications for small and large businesses. Jetty is used to power SaaS (like Zimbra), Cloud Applications (like Google AppEngine), Applications Servers (like Apache Geronimo), and tools (like SoapUI).</p><blockquote><strong>References</strong></blockquote><ul><li><a href="https://github.com/bazlakausar/getting_started_with_JettyServer">GitHub - bazlakausar/getting_started_with_JettyServer</a></li><li><a href="https://github.com/bazlakausar/Deploying-Web-Applications-in-Jetty">GitHub - bazlakausar/Deploying-Web-Applications-in-Jetty</a></li><li><a href="https://www.eclipse.org/jetty/documentation/jetty-11/operations-guide/index.html">Eclipse Jetty: Operations Guide</a></li><li><a href="https://examples.javacodegeeks.com/enterprise-java/jetty/jetty-tutorial-beginners/">Jetty Tutorial for Beginners</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51fae06028f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Growing a farm of rabbits : Managing message flow, scalability & communication across multiple…]]></title>
            <link>https://medium.com/@kausarbazla/growing-a-farm-of-rabbits-managing-message-flow-scalability-communication-across-multiple-399c8c86dae1?source=rss-848e8d226503------2</link>
            <guid isPermaLink="false">https://medium.com/p/399c8c86dae1</guid>
            <category><![CDATA[message-queue]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[queuing]]></category>
            <dc:creator><![CDATA[Bazla Kausar]]></dc:creator>
            <pubDate>Tue, 16 Nov 2021 13:51:24 GMT</pubDate>
            <atom:updated>2021-11-16T13:51:24.524Z</atom:updated>
            <content:encoded><![CDATA[<h3>Growing a farm of rabbits : Managing message flow, scalability &amp; communication across multiple services with RabbitMQ.</h3><p>Is it easy to scale processes? Scalability and stability give a competitive edge because what we as consumers expect is instant results and stable systems. Message queues can be used to link and grow software applications. They enable asynchronous communication between two systems with differing levels of productivity.</p><p>Queuing systems give these services a way to interact by exchanging or moving data in the form of armor from one point (source) to another (a destination). This might happen inside the same application/process or across other services.</p><p>Message brokers are tools that facilitate apps to interact with one another using a queuing system. They act as a form of temporary or intermittent data storage, preventing data loss. These systems can function as a publisher/subscriber system, with one application or process serving as the publisher that produces messages and the other serving as the subscriber that consumes the same.</p><h3><strong><em>How does RabbitMQ spring to picture?</em></strong></h3><p>RabbitMQ is a popular Erlang-based open-source message queuing application. “ RabbitMQ is lightweight and straightforward to deploy on-premises and in the cloud,” according to it’s website. We can use RabbitMQ to create queues, send messages to them, and then consume messages from them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2aqatV7c6bk2zBCZ12Ogg.png" /><figcaption>Message Queue</figcaption></figure><p>In a real-world scenario, we may use RabbitMQ’s capabilities by creating a queue, sending messages to it via an exchange, and then consuming messages from it. But, how does RabbitMQ work?</p><h3>How RabbitMQ works?</h3><p>Several firms use RabbitMQ as a message broker with the AMQP implementation since AMQP is the primary protocol. It’s a protocol that’s mostly used in message-oriented middleware. Message orientation, queuing, dependability, security, and routing are just a few of the key advantages it offers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aG7c30AwPSYv9bsLx01RfA.jpeg" /><figcaption>Message flow in RabbitMQ</figcaption></figure><p>The following are the three RabbitMQ entities:</p><ul><li>Exchange</li><li>Binding</li><li>Queues</li></ul><p>Messages published by a publisher are first received by the Exchange in RabbitMQ, and then message copies are distributed to Queues via Exchanges. Bindings are rules that are used to deliver relevant messages to the proper queues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*NbOUJkDtScBX3dJ9KXYdmw.jpeg" /><figcaption>Exchanges in RabbitMQ</figcaption></figure><p>Messages from producers are received by an exchange, which then sends them to queues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2bZm9Ze6MEZ1ET3fBZjKqw.jpeg" /><figcaption>First queue</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*D3UPZyC6HqFeg3UFHD4nrA.jpeg" /><figcaption>Binding exchange with queue</figcaption></figure><p>Between an exchange and a queue, a binding can be established. Under bindings, you can see all of the queue’s current bindings. You may also unbind a queue from an exchange or create a new queue binding from here.</p><p>Since Queues are consumer facing, it’s crucial that the Exchanges route messages to the appropriate Queues, and Bindings play an important role in this. Messages can be sent to the ultimate customer or consumers can retrieve messages from Queues once they reach them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*gI8oSIBLx73_-GdhGkAujw.jpeg" /><figcaption>Publishing message</figcaption></figure><p>A publisher can pass attributes along with a message when publishing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*aHEIRifHLWNs2Bu-nRvd-g.jpeg" /><figcaption>Message consumed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*bmTsTCCXqJfgoCYCjWoAlw.jpeg" /><figcaption>Queue when a message is published</figcaption></figure><h3>In case of failure</h3><p>What happens if a message isn’t delivered to the receiver? This might happen as a result of a network or application outage. AMQP has a delivery acknowledgement system in place to alleviate this issue. As a result, until we receive a favorable acknowledgement from the customer, a message will remain in the Queue. In the case of a negative acknowledgement, the message can be resent or discarded, based on the publisher’s configuration settings at the time of sending the message.</p><h3>Existing real world applications of RabbitMQ</h3><ul><li>LAIKA gets creative with the RabbitMQ as the animation company’s IT Nervous System.</li></ul><p><a href="https://blog.rabbitmq.com/posts/2019/12/laika-gets-creative-with-rabbitmq-as-the-animation-companys-it-nervous-system/">LAIKA Gets Creative with RabbitMQ As the Animation Company&#39;s IT Nervous System</a></p><ul><li>From a monolithic architechture to microservices &amp; event-based communication.</li></ul><p><a href="https://www.cloudamqp.com/blog/softonic-userstory-rabbitmq-eventbased-communication.html">Meet Softonic - From a monolith architecture to microservices and event-based communication. - CloudAMQP</a></p><ul><li>Scaling RabbitMQ at Goldman Sachs.</li></ul><p><a href="https://tanzu.vmware.com/content/rabbitmq/keynote-scaling-rabbitmq-at-goldman-sachs-jonathan-skrzypek">Keynote: Scaling RabbitMQ at Goldman Sachs - Jonathan Skrzypek</a></p><blockquote>REFERENCES</blockquote><ul><li><a href="https://github.com/bazlakausar/Getting-Started-With-RabbitMQ/blob/main/README.md">Getting-Started-With-RabbitMQ/README.md at main · bazlakausar/Getting-Started-With-RabbitMQ</a></li><li><a href="https://www.rabbitmq.com/">RabbitMQ: One broker to queue them all | RabbitMQ</a></li><li><a href="https://www.cloudamqp.com/blog/part3-rabbitmq-for-beginners_the-management-interface.html">Part 3: The RabbitMQ Management Interface - CloudAMQP</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=399c8c86dae1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>