{"id":729,"date":"2025-01-08T22:16:00","date_gmt":"2025-01-09T01:16:00","guid":{"rendered":"https:\/\/elevata.siteup.dev\/?p=729"},"modified":"2025-01-15T10:12:52","modified_gmt":"2025-01-15T13:12:52","slug":"gerente-de-ti","status":"publish","type":"post","link":"https:\/\/elevata.siteup.dev\/en\/gerente-de-ti\/","title":{"rendered":"Gerente de TI"},"content":{"rendered":"<h4>Learn the differences between multithreading and multiprocessing, and the right configuration for different types of applications. This comprehensive guide uses a relatable post office analogy to explain complex concepts, helping you optimize your Lambda functions for better performance and cost-efficiency.<\/h4>\n<p>In this article, we will be discussing the benefits of running application code concurrently within AWS Lambda functions.<\/p>\n<h2><\/h2>\n<h2>Understanding Concurrency: Multithreading vs Multiprocessing<\/h2>\n<p>Concurrency is the ability to run multiple instances of the same program in parallel or seemingly in parallel. Concurrency can be achieved using a variety of methods, and most commonly it is done through multithreading, multiprocessing, or asynchronous programming. The first two methods refer to the manipulation of the computer\u2019s CPU while asynchronous programming is more of a programming paradigm.<\/p>\n<p>In this article, we will focus on multithreading and multiprocessing. To understand these two concepts, we will walk through the scenario of sending five letters at the post office.<\/p>\n<h3><\/h3>\n<h3>Single-process<\/h3>\n<p>Now that the letters have been sent to be delivered, we turn our focus to the delivery process where a worker will deliver the letters.<\/p>\n<p>In a single-process model, imagine a single delivery worker delivering each of the five letters one by one. The second letter cannot be delivered until the first is completed. Also, any new letter that gets added to the process will require more time for the additional delivery. Just like with the single-threaded scenario, this process is not efficient at all. If this were the actual delivery process, the post office would have a mailing crisis.<\/p>\n<p>&nbsp;<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-643 size-full\" title=\"image\" src=\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-10.png\" alt=\"image\" width=\"628\" height=\"245\" srcset=\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-10.png 628w, https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-10-300x117.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Code Examples to Explore Concurrency<\/h2>\n<p>At 1,769 MB, a function has the equivalent of one vCPU (one vCPU-second of credits per second).<\/p>\n<p>For our examples, we will use Python 3.11 with 1,024 MB of memory allocated unless otherwise specified. We have two separate mock functions: one for I\/O operations and one for CPU-intensive operations. For the I\/O operation, the function sleeps for ten seconds. For the CPU-intensive operation, the function counts down from the INITIAL_COUNT variable, which is set to 200 million, until it hits zero.<\/p>\n<p>&nbsp;<\/p>\n<p>We will specify which test to run using the Lambda console test Event JSON, for example:<\/p>\n<p><code>{<br \/>\n\"type\": \"multi_thread_io\"<br \/>\n}\u00a0<\/code><\/p>\n<p>&nbsp;<\/p>\n<h2>Example: Single-thread, single-process with I\/O-intensive task<\/h2>\n<p><code>{<br \/>\n\"type\": \"single_thread_single_process_io\"<br \/>\n}\u00a0<\/code><\/p>\n<p>&nbsp;<\/p>\n<h2>Cost Considerations<\/h2>\n<p>The grid below shows a cost breakdown based on the run-time duration of the function. For each invocation of the function, the cost breakdown is:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-645 size-full\" title=\"image\" src=\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-11.png\" alt=\"image\" width=\"628\" height=\"210\" srcset=\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-11.png 628w, https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/image-11-300x100.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/p>\n<p>We can see that for both multithreading and multiprocessing, they reduce the per invocation cost for their respective I\/O and CPU-intensive tasks. We see that not only do these concurrency models run their workloads faster, they also reduce costs.<\/p>\n<p>&nbsp;<\/p>\n<h2>Conclusion<\/h2>\n<p>Concurrency is a powerful tool to make your applications more efficient. The three different types of concurrency discussed in this post have specific use cases where they are beneficial. If the application is I\/O intensive, a multithreaded approach is preferred so that the thread isn\u2019t blocked by the I\/O request. If the application is CPU intensive, a multiprocessing approach is preferred so that each task can be executed in parallel. And if the application is traffic intensive, the application will horizontally scale by default so that multiple instances of the function can be running in parallel.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Learn the differences between multithreading and multiprocessing, and the right configuration for different types of applications. This comprehensive guide uses a relatable post office analogy to explain complex concepts, helping you optimize your Lambda functions for better performance and cost-efficiency. In this article, we will be discussing the benefits of running application code concurrently within [&hellip;]<\/p>","protected":false},"author":4002,"featured_media":642,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-729","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vagas"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Gerente de TI - Elevata<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gerente de TI - Elevata\" \/>\n<meta property=\"og:description\" content=\"Learn the differences between multithreading and multiprocessing, and the right configuration for different types of applications. This comprehensive guide uses a relatable post office analogy to explain complex concepts, helping you optimize your Lambda functions for better performance and cost-efficiency. In this article, we will be discussing the benefits of running application code concurrently within [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/elevata.siteup.dev\/en\/gerente-de-ti\/\" \/>\n<meta property=\"og:site_name\" content=\"Elevata\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-09T01:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-15T13:12:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1060\" \/>\n\t<meta property=\"og:image:height\" content=\"440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"tiago\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"tiago\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/\",\"url\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/\",\"name\":\"Gerente de TI - Elevata\",\"isPartOf\":{\"@id\":\"https:\/\/elevata.siteup.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png\",\"datePublished\":\"2025-01-09T01:16:00+00:00\",\"dateModified\":\"2025-01-15T13:12:52+00:00\",\"author\":{\"@id\":\"https:\/\/elevata.siteup.dev\/#\/schema\/person\/a0858de1456683bf322a2a4710d1bfa6\"},\"breadcrumb\":{\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage\",\"url\":\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png\",\"contentUrl\":\"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png\",\"width\":1060,\"height\":440,\"caption\":\"post\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/elevata.siteup.dev\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Gerente de TI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/elevata.siteup.dev\/#website\",\"url\":\"https:\/\/elevata.siteup.dev\/\",\"name\":\"Elevata\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/elevata.siteup.dev\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/elevata.siteup.dev\/#\/schema\/person\/a0858de1456683bf322a2a4710d1bfa6\",\"name\":\"tiago\",\"url\":\"https:\/\/elevata.siteup.dev\/en\/author\/tiago\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Gerente de TI - Elevata","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Gerente de TI - Elevata","og_description":"Learn the differences between multithreading and multiprocessing, and the right configuration for different types of applications. This comprehensive guide uses a relatable post office analogy to explain complex concepts, helping you optimize your Lambda functions for better performance and cost-efficiency. In this article, we will be discussing the benefits of running application code concurrently within [&hellip;]","og_url":"https:\/\/elevata.siteup.dev\/en\/gerente-de-ti\/","og_site_name":"Elevata","article_published_time":"2025-01-09T01:16:00+00:00","article_modified_time":"2025-01-15T13:12:52+00:00","og_image":[{"width":1060,"height":440,"url":"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png","type":"image\/png"}],"author":"tiago","twitter_card":"summary_large_image","twitter_misc":{"Written by":"tiago","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/","url":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/","name":"Gerente de TI - Elevata","isPartOf":{"@id":"https:\/\/elevata.siteup.dev\/#website"},"primaryImageOfPage":{"@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage"},"image":{"@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage"},"thumbnailUrl":"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png","datePublished":"2025-01-09T01:16:00+00:00","dateModified":"2025-01-15T13:12:52+00:00","author":{"@id":"https:\/\/elevata.siteup.dev\/#\/schema\/person\/a0858de1456683bf322a2a4710d1bfa6"},"breadcrumb":{"@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/elevata.siteup.dev\/gerente-de-ti\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#primaryimage","url":"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png","contentUrl":"https:\/\/elevata.siteup.dev\/wp-content\/uploads\/2025\/01\/post.png","width":1060,"height":440,"caption":"post"},{"@type":"BreadcrumbList","@id":"https:\/\/elevata.siteup.dev\/gerente-de-ti\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/elevata.siteup.dev\/"},{"@type":"ListItem","position":2,"name":"Gerente de TI"}]},{"@type":"WebSite","@id":"https:\/\/elevata.siteup.dev\/#website","url":"https:\/\/elevata.siteup.dev\/","name":"Elevata","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/elevata.siteup.dev\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/elevata.siteup.dev\/#\/schema\/person\/a0858de1456683bf322a2a4710d1bfa6","name":"tiago","url":"https:\/\/elevata.siteup.dev\/en\/author\/tiago\/"}]}},"_links":{"self":[{"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/posts\/729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/users\/4002"}],"replies":[{"embeddable":true,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/comments?post=729"}],"version-history":[{"count":2,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/posts\/729\/revisions"}],"predecessor-version":[{"id":1209,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/posts\/729\/revisions\/1209"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/media\/642"}],"wp:attachment":[{"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/media?parent=729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/categories?post=729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elevata.siteup.dev\/en\/wp-json\/wp\/v2\/tags?post=729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}