Back to blog Brazil PaaS

Low-Latency Deploys in Brazil: Why Server Location Matters

How the physical distance between server and user affects your app latency, and what to do about it when serving Brazilian users.

7 min read

By Guara Cloud Editorial

Tested with Node.js 20 / Docker / curl / mtr

If your server sits in Virginia and the user is in São Paulo, every HTTP request travels at least 10,000 km of fiber before it comes back with a response. That is 150 to 250ms of pure network latency, before you count processing, database queries, TLS handshakes, and everything else that happens between click and render.

Hosting in Brazil does not fix every performance problem in your app, but it removes a bottleneck that no amount of code optimization can touch: the speed of light.

Quick answer

To get low latency for Brazilian users, run your application on servers located in Brazil. The RTT difference between a São Paulo server and a US-East (Virginia) server is typically 100 to 200ms less per request. For APIs that make multiple external calls, the savings compound quickly.

Key takeaways

  • Network latency between Brazil and US-East usually runs 150 to 250ms, while within Brazil it sits between 5 and 40ms.
  • Every frontend-to-API request adds this delay. Pages with 5 or 6 sequential calls accumulate it fast.
  • TLS handshake adds 1 to 2 more RTTs. Nearby server means faster handshake.
  • For database-dependent apps, the latency between app and database matters just as much as user-to-app latency.
  • CDN solves static assets but does nothing for dynamic API calls.

When server location matters

Worth worrying about when:

  • Your main audience is Brazilian or Latin American.
  • The app makes many synchronous requests between frontend and backend (SPAs, real-time dashboards, forms with server-side validation).
  • Your app depends on a relational database where queries are latency-sensitive.
  • You already optimized the code but response times are still high due to network overhead.
  • Your product is a B2B SaaS where each extra second of load time generates support tickets.

When location does not change much

No need to invest in this when:

  • The backend is purely async (job queues, batch processing) and nobody waits for a real-time response.
  • The app already sits behind a global CDN and mostly serves static or edge-cached content.
  • Your audience is global and evenly distributed across continents. Edge computing or multi-region setups make more sense than a single location in that case.
  • The main cause of slowness is heavy server-side processing (report generation, ML inference), not network round trips.

How to measure real latency before deciding

Before migrating or choosing a platform, measure. Three commands handle it:

Ping to Virginia server
ping -c 10 ec2.us-east-1.compute.amazonaws.com
Ping to São Paulo server
ping -c 10 sp1.example.com
Measure full HTTP response time
curl -o /dev/null -s -w 'DNS: %{time_namelookup}\nConnect: %{time_connect}\nTLS: %{time_appconnect}\nTTFB: %{time_starttransfer}\nTotal: %{time_total}\n' https://your-api.example.com/health

The time_connect field shows pure RTT (TCP round trip). The time_appconnect shows how long TLS took. If TTFB (time to first byte) is high even with fast connect, the problem lives in processing, not the network.

Another useful test is mtr, which shows each hop along the path:

mtr --report --report-cycles 10 your-api.example.com

If the final hops are in Ashburn or Miami, your server is in the US. If they are in São Paulo (NIC.br AS prefixes, Equinix SP, etc.), it is in Brazil.

The cascading effect of latency in modern applications

A typical SPA built with React or Next.js does something like this when loading a screen:

  1. GET /api/dashboard (network latency + processing)
  2. GET /api/dashboard/charts (after the first one resolves, to know which charts to load)
  3. GET /api/user/preferences (parallel with the second, if you coded it right)
  4. GET /api/notifications (also parallel)

With a Virginia server, each request carries 170ms of latency. With 4 requests in partial cascade, that easily becomes 400 to 500ms of just network time. With a São Paulo server, the same sequence takes 30 to 60ms of network time.

This is without considering WebSocket, Server-Sent Events, or anything that keeps a connection open and depends on low latency to feel responsive.

The database needs to be nearby too

This point gets overlooked a lot. If the API runs in São Paulo but PostgreSQL lives in US-East, every query carries transatlantic latency. An operation with 3 sequential queries adds 3x the RTT between datacenters.

The rule is simple: database and application need to be in the same region. Preferably on the same private network, without going through the public internet. Deploy platforms that offer managed databases in the same region solve this problem at once.

In practice: deploying with low latency

Here is the flow for shipping a service in Brazil using Guara Cloud (which runs in São Paulo on Linode LKE infrastructure):

Before you start

  • Containerized application with Docker
  • A Guara Cloud account
  • Database (if needed) also hosted in Brazil

Step by step for deploying in Brazil

  1. Create the service in Guara Cloud and choose GitHub deploy or Docker image deploy
  2. Configure the HTTP port via the PORT environment variable
  3. Add environment variables (DATABASE_URL, secrets, tokens) through the dashboard
  4. If you need a database, create PostgreSQL from the catalog and point the connection string to it
  5. Deploy, validate the public endpoint, and check the logs
  6. Measure latency with curl from a machine in Brazil to confirm the RTT

After deploy, confirm that TTFB for a simple endpoint (health check, for example) stays under 50ms when measured from São Paulo. If it goes above 100ms, something is wrong with the configuration or network route.

Latency is not everything

Having a server in Brazil helps, but it does not replace the basics:

  • N+1 queries in the database will be slow regardless of region.
  • Missing PostgreSQL indexes add hundreds of ms per query.
  • A large Docker image (1GB+) means slow deploys and long cold starts.
  • Without connection pooling, the overhead of opening a database connection on every request eats whatever latency gains you had.
  • No cache for rarely-changing data (Redis or in-memory) multiplies unnecessary database calls.

Server location is the last optimization, not the first. Fix the code first, then the database, then the network.

Troubleshooting

Common latency problems

Problem High TTFB even with a Brazil server (above 100ms for a health check)
Solution Check whether the database is in the same region and whether connection pooling is active. Slow queries between app and database in different regions is the most common cause.
Problem Inconsistent latency, sometimes 20ms and sometimes 300ms
Solution Possible congestion on intercontinental links. Run mtr and confirm traffic is not routing through Miami or Virginia during peak hours.
Problem Slow cold start after a new deploy
Solution Docker image is too heavy. Use multi-stage builds with an alpine base image. Target: final image under 200MB.
Problem Slow TLS handshake on first request
Solution Confirm the certificate is served with the full chain. Certificates missing the intermediary force the browser to fetch the chain separately, adding requests to connection time.

What is the latency difference between a server in Brazil and one in the US?

Typically 130 to 220ms less per request when the server is in São Paulo and the user is also in Brazil. Intra-Brazil RTT runs between 5 and 40ms versus 150 to 250ms for US-East.

Does a CDN solve the latency problem?

CDN solves it for static assets (JS, CSS, images) and cached content. For dynamic API calls that return different data per user, the origin server needs to be close.

How do I know if my server is in Brazil?

Run ping, traceroute, or mtr to the API domain. If the final hops show Brazilian providers (Ascenty, Equinix SP, NIC.br) and not American ones (Equinix Ashburn, Digital Realty Miami), the server is in Brazil.

Does the database also need to be in Brazil?

Yes, ideally. If the API is in São Paulo but the database is in Virginia, every query between app and database carries intercontinental latency. Keep database and application in the same region.

Does having a server in Brazil affect SEO?

Google considers page load speed as a ranking factor. Hosting in Brazil can improve TTFB and Core Web Vitals for Brazilian users, which indirectly helps local SEO.

Deploy in Brazil with low latency

Infrastructure in São Paulo, automatic HTTPS, logs, and BRL billing. Your users are 5ms away.

Start free