<?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 Bhaskar Bhuyan on Medium]]></title>
        <description><![CDATA[Stories by Bhaskar Bhuyan on Medium]]></description>
        <link>https://medium.com/@bhaskarbhuyan_81402?source=rss-29b535ba96e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hyVZJLG8LCYvgxb-.</url>
            <title>Stories by Bhaskar Bhuyan on Medium</title>
            <link>https://medium.com/@bhaskarbhuyan_81402?source=rss-29b535ba96e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:34:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bhaskarbhuyan_81402/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[AWS RDS, AWS Glue and performance tuning]]></title>
            <link>https://medium.com/@bhaskarbhuyan_81402/aws-rds-aws-glue-and-performance-tuning-cb891fad254b?source=rss-29b535ba96e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb891fad254b</guid>
            <category><![CDATA[aws-rds]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[aws-glue]]></category>
            <category><![CDATA[etl]]></category>
            <dc:creator><![CDATA[Bhaskar Bhuyan]]></dc:creator>
            <pubDate>Tue, 06 Oct 2020 03:54:41 GMT</pubDate>
            <atom:updated>2020-10-06T03:56:20.148Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS RDS, AWS Glue and performance insights</h3><p><strong>AWS Glue</strong> is a fully managed extract, transform, and load (ETL) service that makes it easy for customers to prepare and load their data for analytics. This article will reflect on the process to load data from AWS RDS using AWS Glue and discuss about the common performance bottlenecks faced during such data transfer process along with possible solutions.</p><p><strong>Prerequisites:</strong> A running RDS instance with relevant tables</p><p>Step 1: Create a Glue Connection to the RDS instance</p><p>A connection contains the properties needed to connect to your data. Open AWS Glue homepage on the AWS Console <a href="https://console.aws.amazon.com/glue/">https://console.aws.amazon.com/glue</a>/. Click on “connections” on the left panel and add a new connection. Provide the required fields — Connection Name, <strong>Connection type — RDS, Database engine (eg: MySql), Instance, Database Name, Username and Password.</strong> Finish creating the connection. Once the connection is created click on “Test Connection” tab to check the connection. Once successfully connected you can proceed to the next steps. Quick TIP: If you want to make a connection to a MySQL Database running on an EC2 instance, create the connection with “JDBC” as connection type and provide the url as <strong>jdbc:mysql://&lt;host&gt;:3306/&lt;database_name&gt; </strong>. Also provide the relevant VPC ID, Subnet and Security Group.</p><p>Step 2: Create a Crawler :<br>Create a crawler to crawl the source data store and populate the AWS Glue Data Catalog with tables. The ETL job that you define in AWS Glue use these Data Catalog tables as sources and targets. The ETL job reads from and writes to the data stores that are specified in the source and target Data Catalog tables.</p><p>Step 3: Create a Glue Job, read to a dynamic dataframe or a spark dataframe and do the required transformation. <strong>[</strong><a href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-samples.html"><strong>Code samples</strong></a><strong>]</strong></p><blockquote>dynamic_frame_read = glue_context.create_dynamic_frame.from_catalog(database=&lt;glue DB for the source&gt;, table_name=&lt;glue input table created by the crawler&gt;, additional_options={“hashexpression”:“&lt;partition column&gt;”,“hashpartitions”:“&lt;number of partitions&gt;”}, transformation_ctx=”dynamic_frame_read”)</blockquote><p><strong>Performance Tuning and Monitoring :</strong></p><p>Choosing the right type and number of glue workers is of utmost importance in order to get optimum performance during the ETL process. Performance also highly depends on the type and capacity of the RDS instance as well as indexing /partitioning of the source tables.</p><p>In a Database, the dimensions that matter are the size, latency, throughput, and <strong>IOPS</strong> of the volume. <strong>IOPS</strong> stands for input/output (operations) per second. <br>Parameters that can be used to monitor the performance of the Instance are- Max IOPS, Max Bandwidth, Max Throughput(Read/Write).</p><p>Let us consider for our use case we are using a m4.xlarge instance on the RDS side. The capacity specifications for this particular instance are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LQCZL3iPnFB-gyZgl8WDA.png" /></figure><p>750 - Dedicated bandwidth the m4.xlarge instance have to Amazon EBS, 93.75 - maximum aggregate throughput that can be achieved on that connection with a streaming read workload and 128 KiB I/O size<br>6000 - maximum IOPS the instance can support if you are using a 16 KiB I/O size.</p><p><strong>Calculation:</strong></p><p>Maximum IOPS limit of 6000 with a 16KiB I/O size would mean — <br>6000 x 16 KiB= 96000 KiB/1024 = 93.75 MB, which is the max throughput</p><p>And we have a limit of 750 Mbps when the I/O size is 128 KB — <br>128KiB x 6000 = 768000KiB/1024 = 750 Mbps</p><p>When small I/O operations are physically contiguous, Amazon EBS attempts to merge them into a single I/O. So I/O block size can vary.</p><p>As the IO size can vary, if we have a IO size of 256KiB instead of 128 KiB then we would have a reduced max IOPS of 750x1024/256 = 3000 IOPS for the same instance as the max bandwidth of 750 is exhausted already at 3000 IOPS.</p><p>Tables that are not well partitioned may have lesser IOPS as unpartitioned data present in contiguous blocks would be merged to single I/O of increased size and hence lesser IOPS.</p><p>How to calculate the number of executors that should be provisioned on the glue side?</p><p>For example if you provision 15 standard DPUs in Glue-<br>1 standard DPU = 2 Executors<br>1 Executor = 4 working cores<br>1 DPU reserved for Master<br>1 executor for Driver<br>So for 15 standard DPUs we get</p><p>15–1 DPU for master = 14*2 = 28 executors -1 executor for driver = 27executors*4cores = 108 working cores</p><p>So, 15 DPUs can provide a total of 108 cores and make the same number of parallel connections to the RDS Instance when the glue job starts. Controlling the number of parallel connections is an essential parameter for performance tuning keeping in mind the comparative capacity of the RDS Instance.</p><p>Enabling “Performance Insights” on RDS can give a better detailed logs including the CPU utilisation, Average active sessions and Read/Write throughputs</p><p>Average active session is one of the database’s most important metrics while monitoring the RDS Instance. Lets understand this in the context of User/Application making a query to the Database —</p><ul><li>An application or user connects to the database to process information and provide that information to other applications or frontend clients.</li><li>For each connection to the database there is a shadow process that that executes the actions on the database for the user or application.</li><li>A user (or application) sends queries to the database, and while the query is executing, the shadow process on the database machine is “active” and process that query. The user, meanwhile is waiting for the results of that query and their database connection is blocked until the query returns.</li><li>On the other side, when the users are typing or in the case of an application, possibly doing some application side processing, the shadow process is idle and waiting for more work to do.</li><li>The measure of active sessions is simply the sum of all the active sessions in the database.</li><li>For every active session in the database there is a user or application waiting</li><li>We can say more about activity about a session such as time on CPU, busy with IO operations or waiting for resources.</li><li>This activity is sampled every second in performance insights if enabled on the RDS console. A graph of average active sessions along with Max CPU can be visualised and monitored.</li><li>Max CPU is the number CPUs on the instance</li><li>Bottlenecks can be seen if load increases the Max CPU line in the graph</li></ul><p>We can diagnose any bottlenecks on the Database and visualise the following in terms of “average active sessions” and “Max CPU”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8B11uSpy8Idbijo_ME7hig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZPpKClRfS4tM5LKBuNRS8g.png" /></figure><ol><li>If “average active sessions” &gt; 1, then the database is not blocked and CPU is available for handling queries</li></ol><p>2. “average active sessions” ~ 0 , then Database is Idle</p><p>3. “average active sessions” &lt; number of CPUs, then no bottleneck on the RDS side and CPU is available. Tuning can be done on Application end (Eg. Increasing the executors on Glue to make more parallel connection to the database)</p><p>4. If there are no sessions spending 100% of there time waiting, then the database is not blocked</p><p>5. “average active sessions” &gt; number of CPUs, then there is a bottleneck on the RDS side (example Possible solution: reduce the number of glue workers/executors to limit the number of parallel connections to the Database that may increase the CPU overhead on the RDS side)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb891fad254b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>