{"id":24850,"date":"2022-09-02T00:00:00","date_gmt":"2022-09-02T00:00:00","guid":{"rendered":"https:\/\/www.mailgun.com\/blog\/melhoria-desempenho-mongodb\/"},"modified":"2026-09-16T19:08:50","modified_gmt":"2026-09-16T19:08:50","slug":"melhoria-desempenho-mongodb","status":"publish","type":"blog","link":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/","title":{"rendered":"Como alcan\u00e7amos uma melhoria de 30x no desempenho com a prefer\u00eancia de leitura do MongoDB"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You know what they say\u2026the more redundant you are, the more redundant you are.<\/p>\n\n<p class=\"wp-block-paragraph\">Replica sets are database processes that provide high availability and reduce server failover through redundancy. They are the foundation for production deployments and aren\u2019t really intended to be stand-alone tools that improve your response time and performance metrics. At Mailgun, we noticed high response times in one of our nodes that supports these processes. We hate being slowed down \u2013 especially when it doesn\u2019t make sense. So, we set out to fix it.<\/p>\n\r\n    <nav data-content-type=\"longform\" class=\"toc-block longform-spacings px-5 py-6 px-md-6 px-lg-7 py-md-7 bg-light fs-sm rounded-lg\" aria-labelledby=\"toc-title-5517\"><p class=\"h5 m-0\" id=\"toc-title-5517\">\u00cdndice<\/p><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">01<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#abnormal-response-times-finding-root-cause\">Abnormal response times: Finding root cause<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">02<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#mongodb-performance-documentation-insights\">MongoDB performance: Documentation insights<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">03<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#troubleshooting-the-golang-mongo-client\">Troubleshooting the Golang Mongo Client\u202f<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">04<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#mongodb-performance-improvement\">MongoDB performance\u202fimprovement<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">05<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#how-we-continue-to-optimize\">How we continue to optimize<\/a><\/div><\/div><\/nav>\n<h2 class=\"wp-block-heading\">Abnormal response times: Finding root cause<\/h2>\n\n<p class=\"wp-block-paragraph\">Back in 2021, we noticed some strange performance issues in our response times for USW2. Why are we bringing this up now? Well, we\u2019re still benefiting from the updates we made and we\u2019re looking to share the love.<\/p>\n\n<p class=\"wp-block-paragraph\">We first noticed our rate limit service (based of <a href=\"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/gubernator-cloud-native-distributed-rate-limiting-microservices\/#chapter-1\" target=\"_tabs\" rel=\"noopener noreferrer\">Gubernator<\/a>) was showing consistent response times of 150ms for our processes in USW2. Weirdly, the same code was averaging around 5ms in the 99th percentile of requests. This latency was particularly odd since we average around a 2ms response time in the 50th percentile.\u202fSo, there was something there we really needed to investigate.<\/p>\n\n<p class=\"wp-block-paragraph\">Our starting point was to <b>compare metrics between USW2 and USW1<\/b>. We added some additional metrics to report how long it took to fetch rate limit definitions from MongoDB (when the cache missed), which allowed us to get a better understanding of what was going on.<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4944\" width=\"910\" height=\"444\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph1.png\" alt=\"Graph shows 150ms response time trend in USW2.\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph1.png 910w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph1-300x146.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph1-768x375.png 768w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">The resulting graph confirmed the 150ms trend in USW2 but also showed 2-5ms response times from MongoDB in USE1. This isolated the issue, confirming that <b>something was up with the MongoDB configuration affecting USW2<\/b> specifically.<\/p>\n\n<h2 class=\"wp-block-heading\">MongoDB performance: Documentation insights<\/h2>\n\n<p class=\"wp-block-paragraph\">So, that was \u2018Step 1: Locating the issue\u2019 completed.<\/p>\n\n<p class=\"wp-block-paragraph\">Next, we took a deep dive into MongoDB documentation. The eureka moment came once we understood the MongoDB main topology and discovered the MongoDB default read preferences. MongoDB clients prefer the <i>primary<\/i> instance in a cluster when performing reads. It\u2019s not always nice when your DB plays favorites.<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4945\" width=\"2160\" height=\"1440\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02.png\" alt=\"Image illustrates USW2 reading cross region to the primary node in USE1.\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02.png 2160w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02-300x200.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02-768x512.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02-1024x683.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02-1536x1024.png 1536w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-02-2048x1365.png 2048w\" sizes=\"(max-width: 2160px) 100vw, 2160px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">In the default MongoDB client configuration, the client in USW2 was reading cross region to the <i>primary<\/i> node in USE1. MongoDB defaults are set to where operations read from secondary members, <i>unless<\/i> the set has a single primary. <\/p>\n\n<p class=\"wp-block-paragraph\">Their documentation indicated that if we were to use <code>readPreference=secondaryPreferred<\/code> in our MongoDB client, we would be able to connect to the local MongoDB nodes instead of only the <i>primary<\/i> (USE1).<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4946\" width=\"2160\" height=\"1440\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01.png\" alt=\"Image shows how updating read preference to \u201cequals secondary preference\u201d allows us to connect to the local nodes instead of going across region.\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01.png 2160w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01-300x200.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01-768x512.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01-1024x683.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01-1536x1024.png 1536w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-MongoDB-01-2048x1365.png 2048w\" sizes=\"(max-width: 2160px) 100vw, 2160px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">Perfect. This structuring would allow us to optimize performance, spreading reads across multiple secondary servers where each server is responding to fewer read requests. We thought that updating our read preference would solve the issue but it\u2019s never that simple, is it? Sometimes the situation is more of a clusterf@%* (pun intended).<\/p>\n\n<h2 class=\"wp-block-heading\">Troubleshooting the Golang Mongo Client\u202f<\/h2>\n\n<p class=\"wp-block-paragraph\">We really thought we nailed it with those read preferences but now we were failing to connect to the cluster using the URI:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                PHP                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copiar para a \u00e1rea de transfer\u00eancia\" data-clipboard-success-label=\"Copiado!\" data-clipboard-error-label=\"N\u00e3o foi poss\u00edvel copiar\" data-tooltip=\"Copiar para a \u00e1rea de transfer\u00eancia\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copiar para a \u00e1rea de transfer\u00eancia\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-PHP\">\r\n                                <code id=\"code_0_content\" class=\"language-PHP\">\r\n\r\n                                    mongodb:\/\/mongo-main-n01-us-east-1.postgun.com:27017,mongo-main-n02-us-eas t-1.postgun.com:27017,mongo-main-n03-us-east-1.postgun.com:27017\/?tlsCerti ficateKeyFile=\/etc\/mailgun\/ssl\/mongo.pem&amp;tlsCAFile=\/etc\/mailgun\/ssl\/mongo ca.crt&amp;replicaSet=main&amp;readPreference=secondary&amp;readPreferenceTags=dc:use1 &amp;readPreferenceTags=dc:usw2\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">Turns out, we were <a href=\"https:\/\/www.mailgun.com\/pt\/blog\/product\/atualizacao-semanal-produto-desempenho-banco-dados-50-melhor-mudanca-mailgun-com\/\" target=\"_tabs\" rel=\"noopener noreferrer\">using an older version of the MongoDB client<\/a> (<code>go.mongodb.org\/mongo-driver v1.0.2<\/code>) that didn\u2019t support our TLS options. Once we figured that out, we were finally able to deploy and see if the update to our read preference had any impact once we upgraded to <code>go.mongodb.org\/mongo-driver v1.7.3<\/code>, and fixed a minor URI format issue with our framework:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                PHP                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copiar para a \u00e1rea de transfer\u00eancia\" data-clipboard-success-label=\"Copiado!\" data-clipboard-error-label=\"N\u00e3o foi poss\u00edvel copiar\" data-tooltip=\"Copiar para a \u00e1rea de transfer\u00eancia\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copiar para a \u00e1rea de transfer\u00eancia\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-PHP\">\r\n                                <code id=\"code_0_content\" class=\"language-PHP\">\r\n\r\n                                    PIP-1477: URIWithOptions() now correctly injects a &#039;\/&#039; after host list by thrawn01 \u00b7 Pull Request #92 \u00b7 mailgun\/holster\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n    <div data-content-type=\"longform\"  class=\"callout text-body-color px-5 py-6 px-md-6 px-lg-7 py-md-7 longform-spacings rounded-lg bg-light\" data-theme=\"light\">\r\n\r\n        <div class=\"content-body\"> <b>PSA:<\/b> If your URI Options are not working and the Mongo driver doesn\u2019t give you an error, you are running an older version of Mongo and will need to update.<\/div>\r\n    <\/div>\r\n\n<h2 class=\"wp-block-heading\">MongoDB performance\u202fimprovement<\/h2>\n\n<p class=\"wp-block-paragraph\">This finally did the trick. The effect was dramatic, resulting in a <b>~30x improvement (response time of 5-10ms in the 99th percentile) in read performance for USW2<\/b>.\u202f Not bad.<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4947\" width=\"906\" height=\"406\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph2.png\" alt=\"Graph shows a 30-time improvement and response times hovering between 5-10ms in the 99th percentile.\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph2.png 906w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph2-300x134.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/graph2-768x344.png 768w\" sizes=\"(max-width: 906px) 100vw, 906px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">Our solution started with an investigation of fetch rates to isolate the affected server and led us to optimize our read preference logic based on MongoDB client documentation. Ultimately, we discovered this was also a version issue and we needed to update our MongoDB Go Driver to successfully connect to the cluster URI and improve our response time.<\/p>\n\n<h2 class=\"wp-block-heading\">How we continue to optimize<\/h2>\n\n<p class=\"wp-block-paragraph\">Diagnosing root cause is part of the dev journey and resolving performance issues is done a layer at a time. If you\u2019re experiencing similar latency in your metrics, start with assessing your servers, <a href=\"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/gubernator-cloud-native-distributed-rate-limiting-microservices\/\" target=\"_tabs\" rel=\"noopener noreferrer\">rate limiting services<\/a>, and don\u2019t forget to check the feature supports of your Mongo driver version.<\/p>\n\n<p class=\"wp-block-paragraph\">Investigations and updates like this are how we work to create a better overall system and user experience. So, if you want to hear more from our Engineering team, be sure to subscribe so you don\u2019t miss out on future stories and operation insights.<\/p>\n    <div data-content-type=\"longform\" class=\"longform-spacings\">\r\n        <div class=\"cta bg-primary rounded-lg px-5 py-6 p-md-7 px-md-6\">\r\n                    <div class=\"form-subscription\">\r\n                            <div class=\"h4 mb-3\">\r\n                    Keep me posted! Get great resources in your inbox every week.                <\/div>\r\n                                    <form accept-charset=\"UTF-8\" action=\"\" enctype=\"multipart\/form-data\" data-form-subscription method=\"POST\" style=\"max-width: 400px;\">\r\n                <div class=\"row justify-content-between align-items-top g-2\">\r\n                    <div class=\"col-10\">\r\n                        <input type=\"email\" name=\"email\" class=\"form-control\" placeholder=\"Email\" autocomplete=\"email\" required>\r\n                        <div data-fs=\"error\" role=\"alert\" class=\"invalid-feedback\">\r\n                            Please complete this required field.                        <\/div>\r\n                    <\/div>\r\n                                            <div class=\"col-12 order-last mt-3 fs-xxs\" data-fs=\"acceptance\" style=\"display:none;\">\r\n                            \r\n                                <div class=\"form-check\">\r\n                                    <input id=\"formSubscriptionAcceptance-terms-8259\" class=\"form-check-input\"\r\n                                        type=\"checkbox\" name=\"terms\">\r\n                                    <label for=\"formSubscriptionAcceptance-terms-8259\" class=\"form-check-label text-body-color\">\r\n                                        I have read and agree to the Terms of Service.                                        <span class=\"hs-form-required\">*<\/span>\r\n                                    <\/label>\r\n                                <\/div>\r\n\r\n                            \r\n                                <div class=\"form-check\">\r\n                                    <input id=\"formSubscriptionAcceptance-privacy-5076\" class=\"form-check-input\"\r\n                                        type=\"checkbox\" name=\"privacy\">\r\n                                    <label for=\"formSubscriptionAcceptance-privacy-5076\" class=\"form-check-label text-body-color\">\r\n                                        I have read and agree to the Privacy Policy.                                        <span class=\"hs-form-required\">*<\/span>\r\n                                    <\/label>\r\n                                <\/div>\r\n\r\n                                                    <\/div>\r\n                    \r\n                                            <div class=\"col-12 order-last fs-xxs mb-0 mt-2 text-body-color\">\r\n                            Send me the Mailjet Newsletter. I expressly agree to receive the newsletter and know that I can easily unsubscribe at any time.                        <\/div>\r\n                    \r\n                    <div class=\"col-2\">\r\n                        <button type=\"submit\" value=\"Submit\" aria-label=\"Submit\" class=\"btn btn-secondary btn-icon\">\r\n                            <svg aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/layout\/chevron-right.svg\"><\/svg>\r\n                        <\/button>\r\n                    <\/div>\r\n                <\/div>\r\n\r\n                <input type=\"hidden\" name=\"formSubscriptionRecaptchaToken\" data-fs=\"recaptcha-token\">\r\n                <input type=\"hidden\" name=\"customListID\" value=\"\">\r\n\r\n            <\/form>\r\n            <div data-fs=\"message-success\" style=\"display: none;\">\r\n                <p class=\"mb-0 mt-2 text-body-color\">\r\n                    Check your inbox monthly for your Mailjet Newsletter!                <\/p>\r\n            <\/div>\r\n        <\/div>\r\n        <\/div>\r\n    <\/div>\r\n","protected":false},"excerpt":{"rendered":"<p>M\u00e9tricas de desempenho podem ser um assunto delicado. Quando os tempos de resposta disparam de repente, descobrir o motivo pode ser um desafio. S\u00e3o os seus servidores? Seu c\u00f3digo? Ou ser\u00e1 que \u00e9 uma pequena configura\u00e7\u00e3o ou pr\u00e1tica recomendada perdida em algum lugar do MongoDB&#8230;<\/p>\n","protected":false},"author":35,"featured_media":4843,"menu_order":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"blog_category":[23],"class_list":["post-24850","blog","type-blog","status-publish","has-post-thumbnail","hentry","blog_category-it-and-engineering"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun<\/title>\n<meta name=\"description\" content=\"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.\" \/>\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.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun\" \/>\n<meta property=\"og:description\" content=\"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/\" \/>\n<meta property=\"og:site_name\" content=\"Transactional Email API Service For Developers | Mailgun\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-16T19:08:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-IT-Engineering.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"448\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/\",\"name\":\"O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-IT-Engineering.png\",\"datePublished\":\"2022-09-02T00:00:00+00:00\",\"dateModified\":\"2026-09-16T19:08:50+00:00\",\"description\":\"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-IT-Engineering.png\",\"contentUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-IT-Engineering.png\",\"width\":720,\"height\":448},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/it-and-engineering\\\/melhoria-desempenho-mongodb\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/inicio\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Como alcan\u00e7amos uma melhoria de 30x no desempenho com a prefer\u00eancia de leitura do MongoDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#website\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/\",\"name\":\"Transactional Email API Service For Developers | Mailgun\",\"description\":\"Poderosas APIs de e-mail transacional que permitem a voc\u00ea enviar, receber e rastrear e-mails, criadas com os desenvolvedores em mente. Saiba mais hoje mesmo!\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#organization\",\"name\":\"Transactional Email API Service For Developers | Mailgun\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-android-chrome-512x512-1.png\",\"contentUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-android-chrome-512x512-1.png\",\"width\":512,\"height\":512,\"caption\":\"Transactional Email API Service For Developers | Mailgun\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun","description":"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.","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.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/","og_locale":"pt_BR","og_type":"article","og_title":"O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun","og_description":"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.","og_url":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/","og_site_name":"Transactional Email API Service For Developers | Mailgun","article_modified_time":"2026-09-16T19:08:50+00:00","og_image":[{"width":720,"height":448,"url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-IT-Engineering.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/","url":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/","name":"O que voc\u00ea n\u00e3o sabe sobre o MongoDB e que pode aumentar o seu desempenho em 30x - Transactional Email API Service For Developers | Mailgun","isPartOf":{"@id":"https:\/\/www.mailgun.com\/pt\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/#primaryimage"},"image":{"@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-IT-Engineering.png","datePublished":"2022-09-02T00:00:00+00:00","dateModified":"2026-09-16T19:08:50+00:00","description":"Otimizar as suas prefer\u00eancias de leitura no MongoDB pode reduzir o seu tempo de resposta. Venha conferir os bastidores do Mailgun e veja como descobrimos isso para alcan\u00e7ar uma melhoria de 30x no desempenho.","breadcrumb":{"@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/#primaryimage","url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-IT-Engineering.png","contentUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-IT-Engineering.png","width":720,"height":448},{"@type":"BreadcrumbList","@id":"https:\/\/www.mailgun.com\/pt\/blog\/it-and-engineering\/melhoria-desempenho-mongodb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mailgun.com\/pt\/inicio\/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https:\/\/www.mailgun.com\/pt\/blog\/"},{"@type":"ListItem","position":3,"name":"Como alcan\u00e7amos uma melhoria de 30x no desempenho com a prefer\u00eancia de leitura do MongoDB"}]},{"@type":"WebSite","@id":"https:\/\/www.mailgun.com\/pt\/#website","url":"https:\/\/www.mailgun.com\/pt\/","name":"Transactional Email API Service For Developers | Mailgun","description":"Poderosas APIs de e-mail transacional que permitem a voc\u00ea enviar, receber e rastrear e-mails, criadas com os desenvolvedores em mente. Saiba mais hoje mesmo!","publisher":{"@id":"https:\/\/www.mailgun.com\/pt\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mailgun.com\/pt\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.mailgun.com\/pt\/#organization","name":"Transactional Email API Service For Developers | Mailgun","url":"https:\/\/www.mailgun.com\/pt\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.mailgun.com\/pt\/#\/schema\/logo\/image\/","url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/06\/cropped-android-chrome-512x512-1.png","contentUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/06\/cropped-android-chrome-512x512-1.png","width":512,"height":512,"caption":"Transactional Email API Service For Developers | Mailgun"},"image":{"@id":"https:\/\/www.mailgun.com\/pt\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/blog\/24850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/users\/35"}],"version-history":[{"count":2,"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/blog\/24850\/revisions"}],"predecessor-version":[{"id":24895,"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/blog\/24850\/revisions\/24895"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/media\/4843"}],"wp:attachment":[{"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/media?parent=24850"}],"wp:term":[{"taxonomy":"blog_category","embeddable":true,"href":"https:\/\/www.mailgun.com\/pt\/wp-json\/wp\/v2\/blog_category?post=24850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}