{"id":2941,"date":"2013-03-06T21:41:07","date_gmt":"2013-03-06T20:41:07","guid":{"rendered":"http:\/\/www.gamlor.info\/wordpress\/?p=2941"},"modified":"2021-03-11T09:14:43","modified_gmt":"2021-03-11T08:14:43","slug":"adbcj-some-peformance-numbers","status":"publish","type":"post","link":"https:\/\/www.gamlor.info\/wordpress\/2013\/03\/adbcj-some-peformance-numbers\/","title":{"rendered":"ADBCJ: Some Peformance Numbers"},"content":{"rendered":"<p>This time we look at some performance numbers, comparing JDBC with ADBCJ (<a href=\"https:\/\/github.com\/gamlerhart\/adbcj\">github<\/a>, <a href=\"https:\/\/www.gamlor.info\/wordpress\/tag\/adbcj\/\">blog-posts<\/a>). Particular the performance of small web applications, once implemented with JDBC, once with ADBCJ. Each application is implemented with the <a href=\"http:\/\/www.playframework.com\/\">Play Framework<\/a>, which supports well asynchronous operations. I don&#8217;t want to go into all the gritty details. If you really want to read tons of details, go <a href=\"https:\/\/www.gamlor.info\/files\/Asynchronous-Database-Access-Worth-the-Pain-28-February-2013.pdf\">ahead<\/a>. <\/p>\n<p>The setup looked like this:<\/p>\n<p>&#8211; Amazon EC2: Mysql Extra Large instance<br \/>\n&#8211; Two Amazon EC2: M1 Large instance as web tiers. Running the Play Application.<br \/>\n&#8211; Two Amazon EC2:M1  Medium instance as load tiers. Using <a href=\"http:\/\/grinder.sourceforge.net\/\">Grinder <\/a>to run scripts which use the web app.<\/p>\n<p>We take a look at latency and throughput.<br \/>\n<div id=\"attachment_2988\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/test-setup.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2988\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/test-setup-300x207.png\" alt=\"Test Setup\" width=\"300\" height=\"207\" class=\"size-medium wp-image-2988\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/test-setup-300x207.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/test-setup-1024x709.png 1024w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/test-setup.png 1066w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2988\" class=\"wp-caption-text\">Test Setup<\/p><\/div><\/p>\n<h2>Blog-App<\/h2>\n<p>First let&#8217;s look a small blog app. The app serves posts, which have tags and authors. So the application gets the latest posts and fetches the tags for each post. Also it shows the most popular tags.<br \/>\n<div id=\"attachment_2990\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/blog-post.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2990\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/blog-post-300x184.png\" alt=\"A blog\" width=\"300\" height=\"184\" class=\"size-medium wp-image-2990\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/blog-post-300x184.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/blog-post.png 727w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2990\" class=\"wp-caption-text\">A blog<\/p><\/div><br \/>\nWe take a look at the latency, with a web tier which is far away from its max capacity (around 50% CPU utilization):<\/p>\n<div id=\"attachment_2962\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2962\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner-300x193.png\" alt=\"Latency in Blog Application\" width=\"300\" height=\"193\" class=\"size-medium wp-image-2962\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner-300x193.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner.png 1018w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2962\" class=\"wp-caption-text\">Latency in Blog Application<\/p><\/div>\n<p>We can see that with ADBCJ requests are completed faster. For example with JDBC, it takes around 50ms on average to return the result; the ADBCJ version can do it in about 38ms.<\/p>\n<p>Let\u2019s also look at the throughput. In a small, focused test, where we access the index page in JSON format, ADBCJ performs way better. However, in a more realistic scenario, where we access different pages, the throughput of ADBCJ was about the same.<\/p>\n<div id=\"attachment_2966\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2966\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-300x224.png\" alt=\"Blog: Latency vs Throughput\" width=\"300\" height=\"224\" class=\"size-medium wp-image-2966\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-300x224.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-1024x767.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2966\" class=\"wp-caption-text\">Blog: Latency vs Throughput<\/p><\/div>\n<p>So you are now might tempted to use ADBCJ for a blog like application. Think again, a blog is fairly static application. So we can easily use caching to store the rendered pages. A good cache beats JDBCs and ADBCJs asses! Adding a cache boosts throughput and latency.<\/p>\n<div id=\"attachment_2966\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2966\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-300x224.png\" alt=\"Blog: Latency vs Throughput\" width=\"300\" height=\"224\" class=\"size-medium wp-image-2966\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-300x224.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/scaling-ADBCJvsJDBC1-1024x767.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2966\" class=\"wp-caption-text\">Blog: Latency vs Throughput<\/p><\/div>\n<div id=\"attachment_2967\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2967\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner1-300x193.png\" alt=\"Blog: Latency With Caching\" width=\"300\" height=\"193\" class=\"size-medium wp-image-2967\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner1-300x193.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/BlogLatencyWithoutOutliner1.png 1018w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2967\" class=\"wp-caption-text\">Blog: Latency With Caching<\/p><\/div>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/cache-rocks1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/cache-rocks1-300x236.png\" alt=\"Cache is King\" width=\"300\" height=\"236\" class=\"aligncenter size-medium wp-image-2995\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/cache-rocks1-300x236.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/cache-rocks1.png 943w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>User Content App<\/h2>\n<p>Let&#8217;s look at a more dynamic application, a &#8220;Facebook&#8221; clone. The main page lists posts from the people a person follows. Each post has &#8216;likes&#8217; and comments. Also the site suggests users to follow. Furthermore it also contains messages, which user can send to each other.<br \/>\nAbout 50% of the requests require complex read operations, the other 50% are simple writes, like inserting a new comment.<\/p>\n<p>First, let&#8217;s look again at the latency. We can see that the complex read operation suddenly is three times faster. However, all writes requests are slowed down. This is maybe a tradeoff which you can make. Reading requests are the ones where users have to wait, while write requests can be done in the background via AJAX.<\/p>\n<div id=\"attachment_2972\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentLatencyWIthoutOutliner.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2972\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentLatencyWIthoutOutliner-300x193.png\" alt=\"Latency User Content App\" width=\"300\" height=\"193\" class=\"size-medium wp-image-2972\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentLatencyWIthoutOutliner-300x193.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentLatencyWIthoutOutliner.png 1018w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2972\" class=\"wp-caption-text\">Latency User Content App<\/p><\/div>\n<p>So, I wondered if there a fundamental issue with ADBCJ for writes, or if it&#8217;s an interaction effect. I ran test with separate read and write requests only. Then ADBCJ has always better latency. So, it seems to be an unfortunate interaction.<\/p>\n<div id=\"attachment_2981\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentPostOnly.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2981\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentPostOnly-300x193.png\" alt=\"Reads \/ Writes Only\" width=\"300\" height=\"193\" class=\"size-medium wp-image-2981\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentPostOnly-300x193.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/UserContentPostOnly.png 1018w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2981\" class=\"wp-caption-text\">Reads \/ Writes Only<\/p><\/div>\n<p>Finally, let&#8217;s take a throughput. ADBCJ does way better. Even more, when the system is under pressure, also ADBCJ\u2019s latency for writes start to get better compared to JDBC.<\/p>\n<div id=\"attachment_2985\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/Asynchronous-Database-Access2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2985\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/Asynchronous-Database-Access2-300x213.png\" alt=\"Throughput User Content\" width=\"300\" height=\"213\" class=\"size-medium wp-image-2985\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/Asynchronous-Database-Access2-300x213.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/Asynchronous-Database-Access2-1024x727.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2985\" class=\"wp-caption-text\">Throughput User Content<\/p><\/div>\n<div id=\"attachment_2986\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/LatencyUnderPressure.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2986\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/LatencyUnderPressure-300x193.png\" alt=\"Latency under large Load\" width=\"300\" height=\"193\" class=\"size-medium wp-image-2986\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/LatencyUnderPressure-300x193.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/LatencyUnderPressure.png 1018w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2986\" class=\"wp-caption-text\">Latency under large Load<\/p><\/div>\n<h2>Stats Collection App<\/h2>\n<p>The last application is a &#8216;stats collection app&#8217;, which collections information about the user\u2019s actions. It is very write heavy, with only some rare, long running reads. Here JDBC and ADBCJ latency was about the same. However, the throughput of ADBCJ was much better.<\/p>\n<div id=\"attachment_2998\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/stats-collecting.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2998\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/stats-collecting-300x204.png\" alt=\"Stats Collecting\" width=\"300\" height=\"204\" class=\"size-medium wp-image-2998\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/stats-collecting-300x204.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/stats-collecting-1024x698.png 1024w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/stats-collecting.png 1046w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2998\" class=\"wp-caption-text\">Stats Collecting<\/p><\/div>\n<div id=\"attachment_3010\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/ThroughputStats.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3010\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/ThroughputStats-300x212.png\" alt=\"Stats App Throughput\" width=\"300\" height=\"212\" class=\"size-medium wp-image-3010\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/ThroughputStats-300x212.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2013\/03\/ThroughputStats-1024x725.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-3010\" class=\"wp-caption-text\">Stats App Throughput<\/p><\/div>\n<h2>Conclusion<\/h2>\n<p>So, ADBCJ can speed up your web applications. Of course, only the data serving parts. Keep in mind <a href=\"https:\/\/developers.google.com\/speed\/\">caching, avoiding requests etc<\/a>). Of course you need to do your own experiment for your use case. Next time I&#8217;m going to explain why ADBCJ can support better latency and throughput, with code examples. Stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This time we look at some performance numbers, comparing JDBC with ADBCJ (github, blog-posts). Particular the performance of small web applications, once implemented with JDBC, once with ADBCJ. Each application&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[268,15],"tags":[291,162,293],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/2941"}],"collection":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/comments?post=2941"}],"version-history":[{"count":38,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/2941\/revisions"}],"predecessor-version":[{"id":3749,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/2941\/revisions\/3749"}],"wp:attachment":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/media?parent=2941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/categories?post=2941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/tags?post=2941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}