# Datomic transactor and peer-server as a library

**URL:** <https://forum.datomic.com/t/datomic-transactor-and-peer-server-as-a-library/2401>\
**Category:** General\
**Created:** [April 25, 2024, 6:51am UTC](https://forum.datomic.com/t/datomic-transactor-and-peer-server-as-a-library/2401 "2024-04-25T06:51:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxweber](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@maxweber](https://forum.datomic.com/u/maxweber)\
**Post date:** [April 25, 2024, 6:51am UTC](https://forum.datomic.com/t/datomic-transactor-and-peer-server-as-a-library/2401/1 "2024-04-25T06:51:36Z")

</div>

This expands on my [previous post](https://forum.datomic.com/t/datomic-local-for-datomic-api/2377/5).

## Problem Statement

Random Access Memory is still an expensive resource in computer systems. At least cloud providers charge a lot for it ([Google Cloud](https://cloud.google.com/compute/all-pricing) between $2.50 and $3.00 per month per 1 GB RAM). If you start your software business, you probably only need one server. Our use case is that we want to run one VM (or container) per customer for a SaaS business with several thousands of customers. Running a transactor, peer-server, and your app with the peer library on a single VM consumes more memory than necessary. You have the memory overhead of the three JVMs, and each has its own Datomic object cache, memory index, etc. Datomic-Local helps for these use cases but lacks the powerful entity API.

## Solution Proposal

Offering the Datomic transactor and peer-server as a library would allow to run everything in a single JVM. The transactor, peer-server, and peer-library could share the same Datomic caches. The `datomic.api` and `datomic.client.api` could stay the same, meaning you still need to connect to the corresponding Datomic ports on localhost. Later, the ports could be bound to a network interface to allow additional Datomic peers to connect to this main server (for example, if you start a VM or container just for a single batch job). If you need to upscale your system, you can take apart the initial setup to have separate VMs for the transactors and peer-servers. At the same time, the Datomic peers can still use the same API, so you don’t need to change your application code.

---

<div class="post-metadata">

**Author:** ![chpill](https://avatars.discourse-cdn.com/v4/letter/c/eb8c5e/32.png) [@chpill](https://forum.datomic.com/u/chpill)\
**Post date:** [December 13, 2024, 9:33am UTC](https://forum.datomic.com/t/datomic-transactor-and-peer-server-as-a-library/2401/2 "2024-12-13T09:33:59Z")

</div>

Having the transactor as a library would greatly simplify the setup for hobby projects and staging environments that do not need the reliability gained by having the transactor in its own JVM. This would be a great fit for [GitHub - filipesilva/datomic-pro-sqlite: Get started with Datomic Pro quickly on a single machine setup that will take you pretty far.](https://github.com/filipesilva/datomic-pro-sqlite) for example. +1!
