{"id":6942,"date":"2021-09-01T14:41:57","date_gmt":"2021-09-01T21:41:57","guid":{"rendered":"https:\/\/blogs.infoblox.com\/?p=6942"},"modified":"2021-09-01T14:41:57","modified_gmt":"2021-09-01T21:41:57","slug":"turbocharge-your-infoblox-restful-api-calls-part-4","status":"publish","type":"post","link":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/","title":{"rendered":"Turbocharge your Infoblox RESTful API calls (part 4)"},"content":{"rendered":"<p class=\"g-lead\"><strong>In part 4 of Turbocharge your Infoblox RESTful API calls series, we discuss what asynchronous programming is, and how it can be implemented to dramatically improve the speed of automation scripts.<\/strong><\/p>\n<h3>OVERVIEW<\/h3>\n<p>In this fourth and final article of the\u00a0<strong>Turbocharge your Infoblox RESTful API calls<\/strong>\u00a0series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the\u00a0<strong>aiohttp<\/strong>\u00a0and\u00a0<strong>asyncio<\/strong>\u00a0Python libraries to make async calls to the WAPI.<\/p>\n<div class=\"notices red\">\n<p><strong>NOTE:<\/strong> If you are a regular user of the\u00a0<strong>infoblox-client<\/strong>\u00a0Python client wrapper to the WAPI, you will not be able to leverage async calls since it is not supported by the software. There is an open request to have that added, but at the time this article was written, no support for async had been added.<\/p>\n<\/div>\n<p>The code used in development of this article series is accessible at\u00a0<a href=\"https:\/\/github.com\/ddiguru\/turbocharge_infoblox_api\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/ddiguru\/turbocharge_infoblox_api<\/a><\/p>\n<h3>Async Programming<\/h3>\n<p>Asynchronous programming is the opposite of synchronous programming. A synchronous program has a one-track mind. The flow of a synchronous script is step-wise. It performs each step (task, method or function) one at a time and completes it before moving on to the next step or chunk of data. In the last article, we used batch processing by stuffing numerous network objects into a single\u00a0<strong>request<\/strong>\u00a0WAPI call, this too is an example of a synchronous script.<\/p>\n<p>An async program or script behaves differently. It still uses a single thread of execution at a time, but the difference is that the system does not have to necessarily wait for the step (task, method, or function) to be completed before moving on to the next one. An async script can effectively launch several tasks in succession without having to wait for responses before starting others. The program knows what to do when a previously launched task does finish running.<\/p>\n<h3>Pros<\/h3>\n<ul>\n<li>async programs are typically written to be non-blocking<\/li>\n<li>super fast!<\/li>\n<\/ul>\n<h3>Cons<\/h3>\n<ul>\n<li>more complex to write<\/li>\n<li>requires specific async versions of libraries, i.e. it is not supported in\u00a0<strong>infoblox-client<\/strong><\/li>\n<li>poorly written tasks can block, delay or starve outstanding tasks that need running<\/li>\n<\/ul>\n<p>Since we&#8217;re loading 1,024 networks, we want to do so as quickly as possible. Our business logic is simple and very well suited for async programming, because we effectively want to &#8220;shove it in there&#8221;. Our script doesn&#8217;t have any dependencies that have to be solved between each network. It&#8217;s truly &#8220;best effort&#8221; &#8211; try to get them all inserted\/created and maybe output to a log any that fail.<\/p>\n<p>Recall the original synchronous script logic for adding networks was as follows:<\/p>\n<pre><code class=\"language-python hljs\">    <span class=\"hljs-comment\"># create IPv4 Network object(s) one at a time<\/span>\r\n    <span class=\"hljs-keyword\">for<\/span> network <span class=\"hljs-keyword\">in<\/span> networks:\r\n        payload = <span class=\"hljs-built_in\">dict<\/span>(network=<span class=\"hljs-built_in\">str<\/span>(network), comment=<span class=\"hljs-string\">'test-network'<\/span>)\r\n        s.post(<span class=\"hljs-string\">f'<span class=\"hljs-subst\">{url}<\/span>\/network'<\/span>, data=json.dumps(payload), verify=<span class=\"hljs-literal\">False<\/span>)<\/code><\/pre>\n<p>We refactored the above script to use asynchronous logic for adding networks as follows:<\/p>\n<pre><code class=\"language-python hljs\">\r\n    auth = aiohttp.BasicAuth(login=ibx_username, password=ibx_password)\r\n    <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-keyword\">with<\/span> aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar(unsafe=<span class=\"hljs-literal\">True<\/span>)) <span class=\"hljs-keyword\">as<\/span> session:\r\n        <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-keyword\">with<\/span> session.get(<span class=\"hljs-string\">f'<span class=\"hljs-subst\">{url}<\/span>\/grid'<\/span>, auth=auth, ssl=<span class=\"hljs-literal\">False<\/span>) <span class=\"hljs-keyword\">as<\/span> res:\r\n            logger.debug(res.status)\r\n            tasks = []\r\n            sem = asyncio.Semaphore(<span class=\"hljs-number\">16<\/span>)\r\n            <span class=\"hljs-keyword\">for<\/span> network <span class=\"hljs-keyword\">in<\/span> networks:\r\n                task = asyncio.ensure_future(load_network(sem, session, network))\r\n                tasks.append(task)\r\n\r\n            responses = asyncio.gather(*tasks)\r\n            <span class=\"hljs-keyword\">await<\/span> responses<\/code><\/pre>\n<p>Note: the call to\u00a0<strong>load_network(sem, session, network)<\/strong>\u00a0&#8211; we implement that quite simply with a simple function the following:<\/p>\n<pre><code class=\"language-python hljs\"><span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">load_network<\/span>(<span class=\"hljs-params\">sem, session, network<\/span>):<\/span>\r\n    <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-keyword\">with<\/span> sem:\r\n        <span class=\"hljs-keyword\">await<\/span> fetch(session, network)<\/code><\/pre>\n<p>The\u00a0<strong>load_network<\/strong>\u00a0method call takes a semaphore, our session, and a network object as args and asynchronously calls another method called fetch. This is the non-blocking method will make the async call to the server.<\/p>\n<pre><code class=\"language-python hljs\"><span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">fetch<\/span>(<span class=\"hljs-params\">session, network<\/span>):<\/span>\r\n    payload = <span class=\"hljs-built_in\">dict<\/span>(network=<span class=\"hljs-built_in\">str<\/span>(network), comment=<span class=\"hljs-string\">'test-network'<\/span>)\r\n    <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-keyword\">with<\/span> session.post(<span class=\"hljs-string\">f'<span class=\"hljs-subst\">{url}<\/span>\/network'<\/span>, data=payload, ssl=<span class=\"hljs-literal\">False<\/span>) <span class=\"hljs-keyword\">as<\/span> res:\r\n        <span class=\"hljs-keyword\">if<\/span> res.status == <span class=\"hljs-number\">201<\/span>:\r\n            logger.info(<span class=\"hljs-string\">f'successfully inserted network <span class=\"hljs-subst\">{<span class=\"hljs-built_in\">str<\/span>(network)}<\/span>'<\/span>)\r\n        <span class=\"hljs-keyword\">else<\/span>:\r\n            logger.error(<span class=\"hljs-string\">f'failed to load network <span class=\"hljs-subst\">{<span class=\"hljs-built_in\">str<\/span>(network)}<\/span>'<\/span>)<\/code><\/pre>\n<p>The difference is that it&#8217;s an async function call. The function is called without waiting for the response. See the full listing for\u00a0<a href=\"https:\/\/github.com\/ddiguru\/turbocharge_infoblox_api\/blob\/main\/wapi-async.py\" target=\"_blank\" rel=\"noopener noreferrer\">wapi-async.py<\/a><\/p>\n<p>If we graphically depict the flow and operation of our refactored async script for creating network objects, it would look something like the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6944\" src=\"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/ddi-guru-turbo-4-image-1.jpg\" alt=\"\" width=\"478\" height=\"273\" srcset=\"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image-1.jpg 478w, https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image-1-300x171.jpg 300w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/p>\n<div class=\"e-content\">\n<p>Each numbered request is an async task which creates or inserts one IPv4 Network at a time. This is yet another script which makes use of concurrency &#8211; the difference is, the script is actually single threaded. Asynchronous programs use cooperative multitasking instead of preemptive multitasking. The operating system does not do any context switching, instead, tasks voluntarily yield control periodically &#8211; at completion, when they are idle, or logically blocked. It&#8217;s said to be cooperative because all programs must cooperate in order for the scheduling scheme to work. In the example above, we use a Semaphore as a mechanism to control the max number of tasks that can run at any given time. This is analogous how we limited the max number of threads in our ThreadPool in the second article.<\/p>\n<h3>Results<\/h3>\n<p>When I started to test\u00a0<a href=\"https:\/\/github.com\/ddiguru\/turbocharge_infoblox_api\/blob\/main\/wapi-async.py\" target=\"_blank\" rel=\"noopener noreferrer\">wapi-async.py<\/a>\u00a0against\u00a0<a href=\"https:\/\/github.com\/ddiguru\/turbocharge_infoblox_api\/blob\/main\/wapi-network.py\" target=\"_blank\" rel=\"noopener noreferrer\">wapi-network.py<\/a>, I noticed performance of the script varied widely as I tuned the script for how many semaphores to use. Therefore, the script was tested numerous times with different semaphore values, starting with 2 and ending with 32 semaphores. Notice how the performance drops off significantly when we use a value of 32!<\/p>\n<div class=\"simple-responsive-table\">\n<div>\n<table>\n<thead>\n<tr>\n<th>Test<\/th>\n<th>Pass #1<\/th>\n<th>Pass #2<\/th>\n<th>Pass #3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>wapi-network.py<\/td>\n<td>33.85<\/td>\n<td>33.64<\/td>\n<td>33.33<\/td>\n<\/tr>\n<tr>\n<td>wapi-async.py w\/ 2 semaphores<\/td>\n<td>23.56<\/td>\n<td>23.40<\/td>\n<td>23.64<\/td>\n<\/tr>\n<tr>\n<td>wapi-async.py w\/ 4 semaphores<\/td>\n<td>23.99<\/td>\n<td>19.99<\/td>\n<td>21.56<\/td>\n<\/tr>\n<tr>\n<td><strong>wapi-async.py w\/ 8 semaphores<\/strong><\/td>\n<td><strong>19.26<\/strong><\/td>\n<td><strong>19.39<\/strong><\/td>\n<td><strong>19.50<\/strong><\/td>\n<\/tr>\n<tr>\n<td>wapi-async.py w\/ 16 semaphores<\/td>\n<td>27.81<\/td>\n<td>23.13<\/td>\n<td>23.87<\/td>\n<\/tr>\n<tr>\n<td>wapi-async.py w\/ 32 semaphores<\/td>\n<td>55.31<\/td>\n<td>55.50<\/td>\n<td>55.80<\/td>\n<\/tr>\n<tr>\n<td><strong>% improvement<\/strong><\/td>\n<td><strong>43.10%<\/strong><\/td>\n<td><strong>42.36%<\/strong><\/td>\n<td><strong>41.50%<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The sweetspot seems to be 8 semaphores &#8211; results may vary according to how busy the Grid Master is. Recall, this testing is done in an isolated lab with minimal load on the Grid Master. So, the sweetspot may be lower in a production environment. The performance improvement shown above is a result of comparing our base script with the async script using the sweetspot of 8.<\/p>\n<div class=\"notices blue\">\n<p>NOTE: this test was performed with HTTP Keepalive enabled.<\/p>\n<\/div>\n<p>Overall, the async script was more than 40% faster in loading the 1,024 networks into the Grid.<\/p>\n<h3>Conclusion<\/h3>\n<p>A lot of different programming techniques were discussed in this series of articles to help increase the performance of your automation scripts. Here are the main takeaways:<\/p>\n<ul>\n<li>Enable HTTP Keepalive on your Infoblox Grid &#8211; There&#8217;s no reason not to!<\/li>\n<li>Experiment with Python threading, and Python asyncio modules. See where they fit in your helping you develop your trove of scripts for improving your automation.<\/li>\n<li>Implement the Infoblox WAPI\u00a0<em>request<\/em>\u00a0module in your scripts when you are performing predictable data insert operations to load networks, zones, DNS resource records, etc.<\/li>\n<li>Experiment and Test (wash, rinse, repeat)<\/li>\n<\/ul>\n<p>While none of these things are going to be a panacea in all situations, there is going to be a time and opportunity for each. If you learn, experiment, and test thoroughly with these techniques to bolster your skill set, you will NOT be disappointed and they will serve you well!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In part 4 of Turbocharge your Infoblox RESTful API calls series, we discuss what asynchronous programming is, and how it can be implemented to dramatically improve the speed of automation scripts. OVERVIEW In this fourth and final article of the\u00a0Turbocharge your Infoblox RESTful API calls\u00a0series, we explain what async programming is, its pros and cons, [&hellip;]<\/p>\n","protected":false},"author":358,"featured_media":6943,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[571,16],"class_list":{"0":"post-6942","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-community","8":"tag-restful-api","9":"tag-infoblox","10":"entry"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Turbocharge your Infoblox RESTful API calls (part 4)<\/title>\n<meta name=\"description\" content=\"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Turbocharge your Infoblox RESTful API calls (part 4)\" \/>\n<meta property=\"og:description\" content=\"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/\" \/>\n<meta property=\"og:site_name\" content=\"Infoblox Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-01T21:41:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Patrick Piper\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick Piper\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/\"},\"author\":{\"name\":\"Patrick Piper\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/person\\\/ac7cfb5c14c9216ae7cb53acfe37c1db\"},\"headline\":\"Turbocharge your Infoblox RESTful API calls (part 4)\",\"datePublished\":\"2021-09-01T21:41:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/\"},\"wordCount\":1076,\"publisher\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/ddi-guru-turbo-4-image.jpg\",\"keywords\":[\"RESTful API\",\"Infoblox\"],\"articleSection\":[\"Community\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/\",\"name\":\"Turbocharge your Infoblox RESTful API calls (part 4)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/ddi-guru-turbo-4-image.jpg\",\"datePublished\":\"2021-09-01T21:41:57+00:00\",\"description\":\"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/ddi-guru-turbo-4-image.jpg\",\"contentUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/ddi-guru-turbo-4-image.jpg\",\"width\":1200,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/community\\\/turbocharge-your-infoblox-restful-api-calls-part-4\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Community\",\"item\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/category\\\/community\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Turbocharge your Infoblox RESTful API calls (part 4)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\",\"name\":\"infoblox.com\\\/blog\\\/\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#organization\",\"name\":\"Infoblox\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/infoblox-logo-2.svg\",\"contentUrl\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/wp-content\\\/uploads\\\/infoblox-logo-2.svg\",\"width\":137,\"height\":30,\"caption\":\"Infoblox\"},\"image\":{\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/#\\\/schema\\\/person\\\/ac7cfb5c14c9216ae7cb53acfe37c1db\",\"name\":\"Patrick Piper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_358_1628788417-96x96.jpg\",\"url\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_358_1628788417-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/blogs.infoblox.com\\\/wp-content\\\/uploads\\\/avatar_user_358_1628788417-96x96.jpg\",\"caption\":\"Patrick Piper\"},\"description\":\"Patrick has over 24 years of experience in IT networking, with an emphasis on IP Address Management, DNS, and DHCP technologies. He graduated from N.C. State University with a BA in Business Management and was an All-American in Cross Country and Track. During his early work years following graduation, he took his running to the National level at the marathon distance, by qualifying for the 1994 Olympic Trials in just my first Marathon. Today, he appliesy the same hard work ethic and dedication that helped him be successful as an athlete to his IT consultancy. He has followed a well-planned job progression, starting as a systems engineer working with network operating systems and routing technologies. He advanced into consulting, where he learned how to effectively communicate and interact with technical and non-technical personnel on various large-scale IP services projects. In 1995, he founded Netlinx, Inc. originally as a systems integration firm focused on small business networking. Over the last 20 years his focus and emphasis has been on providing professional consulting and development services in the DDI space to large Enterprise firms. In 2012, he joined Wells Fargo &amp; Co. as the technical lead for the DDI Engineering team where he leads design, architecture, and engineering tasks as part of a large DDI reengineering project. In Aug. of 2014, he re-branded Netlinx, Inc. to DDI Guru, LLC, as a top-provider of DDI Engineering, Consulting, and Automation Services company.\",\"url\":\"https:\\\/\\\/www.infoblox.com\\\/blog\\\/author\\\/patrick-piper\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Turbocharge your Infoblox RESTful API calls (part 4)","description":"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/","og_locale":"en_US","og_type":"article","og_title":"Turbocharge your Infoblox RESTful API calls (part 4)","og_description":"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.","og_url":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/","og_site_name":"Infoblox Blog","article_published_time":"2021-09-01T21:41:57+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg","type":"image\/jpeg"}],"author":"Patrick Piper","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Patrick Piper","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#article","isPartOf":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/"},"author":{"name":"Patrick Piper","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/person\/ac7cfb5c14c9216ae7cb53acfe37c1db"},"headline":"Turbocharge your Infoblox RESTful API calls (part 4)","datePublished":"2021-09-01T21:41:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/"},"wordCount":1076,"publisher":{"@id":"https:\/\/www.infoblox.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#primaryimage"},"thumbnailUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg","keywords":["RESTful API","Infoblox"],"articleSection":["Community"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/","url":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/","name":"Turbocharge your Infoblox RESTful API calls (part 4)","isPartOf":{"@id":"https:\/\/www.infoblox.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#primaryimage"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#primaryimage"},"thumbnailUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg","datePublished":"2021-09-01T21:41:57+00:00","description":"Turbocharge your Infoblox RESTful API calls (part 4). In this fourth and final article of the Turbocharge your Infoblox RESTful API calls series, we explain what async programming is, its pros and cons, as well as demonstrate how how it can be leveraged to vastly improve the performance of scripts which make use of the Infoblox WAPI. In this article we will again take our original WAPI script which inserts 1,024 IPv4 network objects into the grid, and refactor it into a script which leverages async programming. For this, we will use the aiohttp and asyncio Python libraries to make async calls to the WAPI.","breadcrumb":{"@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#primaryimage","url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg","contentUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/ddi-guru-turbo-4-image.jpg","width":1200,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.infoblox.com\/blog\/community\/turbocharge-your-infoblox-restful-api-calls-part-4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.infoblox.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Community","item":"https:\/\/www.infoblox.com\/blog\/category\/community\/"},{"@type":"ListItem","position":3,"name":"Turbocharge your Infoblox RESTful API calls (part 4)"}]},{"@type":"WebSite","@id":"https:\/\/www.infoblox.com\/blog\/#website","url":"https:\/\/www.infoblox.com\/blog\/","name":"infoblox.com\/blog\/","description":"","publisher":{"@id":"https:\/\/www.infoblox.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.infoblox.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.infoblox.com\/blog\/#organization","name":"Infoblox","url":"https:\/\/www.infoblox.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/infoblox-logo-2.svg","contentUrl":"https:\/\/www.infoblox.com\/blog\/wp-content\/uploads\/infoblox-logo-2.svg","width":137,"height":30,"caption":"Infoblox"},"image":{"@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.infoblox.com\/blog\/#\/schema\/person\/ac7cfb5c14c9216ae7cb53acfe37c1db","name":"Patrick Piper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_358_1628788417-96x96.jpg","url":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_358_1628788417-96x96.jpg","contentUrl":"https:\/\/blogs.infoblox.com\/wp-content\/uploads\/avatar_user_358_1628788417-96x96.jpg","caption":"Patrick Piper"},"description":"Patrick has over 24 years of experience in IT networking, with an emphasis on IP Address Management, DNS, and DHCP technologies. He graduated from N.C. State University with a BA in Business Management and was an All-American in Cross Country and Track. During his early work years following graduation, he took his running to the National level at the marathon distance, by qualifying for the 1994 Olympic Trials in just my first Marathon. Today, he appliesy the same hard work ethic and dedication that helped him be successful as an athlete to his IT consultancy. He has followed a well-planned job progression, starting as a systems engineer working with network operating systems and routing technologies. He advanced into consulting, where he learned how to effectively communicate and interact with technical and non-technical personnel on various large-scale IP services projects. In 1995, he founded Netlinx, Inc. originally as a systems integration firm focused on small business networking. Over the last 20 years his focus and emphasis has been on providing professional consulting and development services in the DDI space to large Enterprise firms. In 2012, he joined Wells Fargo &amp; Co. as the technical lead for the DDI Engineering team where he leads design, architecture, and engineering tasks as part of a large DDI reengineering project. In Aug. of 2014, he re-branded Netlinx, Inc. to DDI Guru, LLC, as a top-provider of DDI Engineering, Consulting, and Automation Services company.","url":"https:\/\/www.infoblox.com\/blog\/author\/patrick-piper\/"}]}},"_links":{"self":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/6942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/users\/358"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/comments?post=6942"}],"version-history":[{"count":1,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/6942\/revisions"}],"predecessor-version":[{"id":6945,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/posts\/6942\/revisions\/6945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/media\/6943"}],"wp:attachment":[{"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/media?parent=6942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/categories?post=6942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infoblox.com\/blog\/wp-json\/wp\/v2\/tags?post=6942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}