Loving @tursodatabase these days. By using their embedded replicas I reduced average load times on one of my web apps from 5.03 seconds to only 58ms !!! #buildInPublic
Set your teams free with Turso Embedded Replicas
Turso Embedded Replicas are fast. But that's only one of the many benefits of this new architecture.
![Cover image for Set your teams free with Turso Embedded Replicas](/_next/image?url=%2Fimages%2Fblog%2Fset-your-teams-free-with-turso-embedded-replicas%2Fcover.png&w=3840&q=100)
Here’s a dirty secret about all databases: when you fire a slow query, it’s not just your query that gets slow. It gets slow for everybody. This is a phenomenon that exists whether you’re using a SQL or a NoSQL database, and it’s common with shared resources. Ever heard of how one home can bring down the property values of all homes around it? Similar issue.
That is why you’ll typically have so many layers, both in software and organizationally, to make sure that access to the database is carefully controlled. Those layers of people and processes slow organizations down. Thankfully, Turso offers a way to resolve these organizational issues, allowing your teams to move faster without disrupting operations, while delivering low latencies.
# Enter Turso Embedded Replicas
Turso is a client-server database built on SQLite. Usually, you interact with Turso on a local file, as you would with SQLite, but then run it in production over our HTTP-based protocol.
But there’s a mode of operation that allows you to achieve the same microsecond-level latencies that you can achieve with local SQLite, while keeping all the production benefits of a Turso database: Embedded Replicas.
# How do Embedded Replicas work
Periodically, the replica will reach out to the main database, and sync the changes to a SQLite file. You can sync to as many files as you want, and then can be anywhere you want, including multiple servers and mobile devices. This works well regardless of the size of the database, since only the new changes are replicated.
One of the top reasons developers use Turso’s Embedded Replicas is because once the data is replicated locally, there is no more network latency involved in reading the data. From milliseconds, your queries will go to microseconds. And in aggregate, for any API that is doing multiple queries, that means that can be the difference between multi-second responses and millisecond responses.
However, that is another big benefit of Embedded Replicas, that has the potential to transform how your organization uses databases
# Embedded Replicas as a tool to unleash your organization’s potential.
The cost to keep a replica in sync depends only on the amount of bytes transferred. But once the data is transferred, there is no more impact on the main database. All queries are local to the application server issuing them.
You can write the slowest, most inefficient query in the world. Nobody else will suffer. Another advantage of this model is that performance issues, if any, occur in a system the developer understands and does not need to ask for help to debug. They happen right there, on their server, in a way that they can profile using tools they are already familiar with.
The result is that everything in this equation is faster:
- Developers can experiment faster, because they can do whatever they want in their application without fear of disrupting the database.
- Developers can get to production faster, because the performance issues are immediate to them, and accessible through tools, like profilers, that they are already used to.
- The APIs are faster, because they can serve data from a local file, without any network access.
# Conclusion
Developers all want software that runs faster, and organizations want software that is delivered faster. Access to the database is often heavily mediated, since it is a shared resource. The risk of queries going awry and disrupting everyone is too high.
Turso tackles both problems at once. It replicates your data back to a SQLite file, allowing developers to each operate independently in a copy of the database.
Try Turso Embedded Replicas today for free at turso.tech
![scarf](https://static.scarf.sh/a.png?x-pxid=3976f68e-9b66-42d1-829a-9357a2c397cc)