Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To scale a Rails application across VPS servers, run two or more identical, stateless Puma nodes behind an external load balancer. Keep the database, cache and session store, job queue, and uploaded files on shared or dedicated services; then deploy the same application image to every node. Add servers only after measurements show that web CPU or memory is the bottleneck—additional nodes cannot repair a saturated database or inefficient queries.

The practical work is capacity planning, state removal, connection budgeting, repeatable deployment, and failure testing. The steps below show how to build that arrangement without turning a two-server setup into an unreliable collection of independent machines.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reference architecture

A multi-VPS Rails installation is a small distributed system. Each web node should be replaceable: a request may arrive at any healthy node, and removing one node should not log users out, lose an upload, or strand a background job.

Users
  |
External load balancer / reverse proxy
  |-----------------------------|
Rails + Puma node A        Rails + Puma node B  (add identical nodes as needed)
  |-----------------------------|
Private network services:
  PostgreSQL or MySQL primary
  Shared cache and session store
  Background-job queue and workers
  Durable object or block storage
  Logs, metrics, traces, alerts

Rails’ multiple-database guidance places application-scale traffic distribution outside the framework. The load balancer therefore belongs in the VPS or cloud network tier, not in controller code or an ad-hoc round-robin feature inside Rails.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

What each layer is responsible for

  • Load balancer: terminates TLS if desired, checks node health, distributes connections, and drains nodes during deployment.
  • Web nodes: run the same Rails release and Puma configuration. They should contain no irreplaceable data.
  • Database: stores transactional state. Size its CPU, memory, storage I/O, and connection limit for the aggregate demand of every node.
  • Cache and sessions: provide a shared, low-latency store so a user’s next request can land on any node.
  • Job workers: consume a shared queue independently of web traffic. Scale them when queue latency, not HTTP throughput, is the constraint.
  • Durable storage: holds uploads and generated files outside a node’s ephemeral disk.
  • Observability: centralizes logs and metrics so a failure on one VPS is visible from the remaining system.

Confirm that adding a node will help

Scaling horizontally before identifying the bottleneck usually increases cost and operational complexity without increasing throughput. First capture a representative baseline under realistic traffic: anonymous reads, authenticated requests, writes, uploads, and background-job activity.

Metrics to record

  • Requests per second and completed jobs per second.
  • P50 (median), P95, and P99 request latency. P99 is the point below which 99 percent of requests finish; the slowest one percent is often where users experience failure.
  • HTTP 5xx rate, timeout rate, and load-balancer health-check failures.
  • Per-node CPU saturation, memory RSS, swap activity, and process restarts.
  • Database query time, lock waits, active connections, pool wait time, and slow-query frequency.
  • Cache hit rate, queue depth, oldest job age, and worker utilization.
  • Storage latency, capacity, and failed upload or download operations.

Average response time can look healthy while tail latency is deteriorating. Use the percentile values and saturation signals to decide whether web nodes, database resources, queries, or a downstream service need attention.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Signs that web nodes are the limiting resource

  • CPU remains near saturation on every Puma node while database CPU and lock waits remain moderate.
  • Requests queue in Puma, but database pool wait time is low.
  • Adding a node in a controlled test increases total throughput and keeps P95/P99 latency from rising.

If the database is at its connection ceiling, queries are waiting on locks, or one endpoint performs an inefficient scan, more web servers generally make the queue longer. Fix the query, index, transaction, or database capacity first.

Size Puma workers and threads per VPS

Puma is Rails’ default application server. A worker is a separate process that provides process-level parallelism; threads are concurrent request handlers inside each worker. More workers usually increase memory use, while more threads can improve concurrency for I/O-bound requests but also increase contention and database demand.

Start with a hypothesis, not a universal number

Set workers near the number of CPU cores available to the VPS as an initial hypothesis, then test it. Shared VPS providers may expose misleading CPU counts, so WEB_CONCURRENCY=auto can create too many workers for the actual entitlement. Treat automatic sizing as a convenience to verify, not as a capacity guarantee.

Rails’ generated Puma configuration uses three threads by default. That value is a safe configuration default, not a benchmark or a claim that three threads are optimal for your workload. Active Record’s default pool limit is five, so changing Puma concurrency without changing the pool can cause threads to wait for connections.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

A controlled tuning loop

  1. Record the current worker count, thread range, Ruby version, database pool, node memory, and CPU allocation.
  2. Change one variable—workers or threads—on a test node or server group.
  3. Load-test the same read, write, authenticated, and upload flows.
  4. Compare requests per second, P50/P95/P99 latency, error rate, CPU, RSS memory, garbage-collection behavior, and database wait time.
  5. Keep the change only if throughput improves without unacceptable tail latency, memory pressure, or database contention.
  6. Repeat with the next single-variable change, then apply the measured configuration to every identical node.

Memory and Ruby runtime considerations

Each Puma worker has process overhead, and a threaded process can retain more objects. Leave headroom for deploys, file processing, logging, and the operating system; a configuration that fits at idle may fail when all workers handle uploads simultaneously. Rails recommends evaluating YJIT on supported Ruby versions and notes that jemalloc can reduce fragmentation in threaded Puma workloads. Validate either change on the same VPS image and workload you will run in production rather than transferring a result from another machine.

Example configuration variables

Keep the values in deployment configuration so every node receives the same settings. For example:

WEB_CONCURRENCY=4
RAILS_MAX_THREADS=5

The numbers above are illustrative starting values, not a promise of capacity. Set the database pool for each Puma process deliberately and verify that total possible connections fit the database budget described next.

Budget database connections before adding nodes

Active Record’s connection pool is configured per application server process. With Puma workers, each worker process normally owns its own pool. The database must therefore accommodate the aggregate of all workers on all nodes, plus operational headroom.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use an explicit calculation

Calculate a worst-case web connection demand as:

web connections = number of VPS nodes × workers per node × pool size per worker

Then reserve additional connections for migrations, console sessions, monitoring, administrative access, and any replicas or job processes that connect directly. If your pool size is five and you run three nodes with four workers each, the web tier alone can request 60 connections before those extras. The arithmetic is a planning tool; confirm actual usage in database metrics.

Match pool and thread settings

A worker whose threads can all execute database-backed requests should have a pool large enough to avoid unnecessary waiting, but enlarging every pool blindly can exhaust the database. If the database is the constraint, reduce concurrency, optimize queries, increase database capacity, or add a connection-management layer rather than simply adding VPS nodes.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

When replicas or sharding are justified

Read replicas can separate read workload from a primary, but introduce replication lag and read-after-write decisions. Horizontal sharding changes data placement and operational procedures. Use either only when query and data-growth evidence warrants the consistency, failover, backup, and restore complexity. Rails documents multiple databases and sharding, while still placing large-scale request load balancing outside Rails.

Make sessions, jobs, and files shareable

Horizontal scaling fails when a request depends on local process memory or a node’s local disk. Design every user-visible state transition so another node can continue it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sessions and cache

Put server-side sessions and cache entries in a shared service reachable from every web node. Keep encryption and signing secrets identical across the fleet and rotate them through the deployment secret mechanism, not by editing one VPS. If you use encrypted cookie sessions, the cookie itself travels with the request, but all nodes still need the same secret and compatible serializer settings.

Background jobs

Send jobs to a shared queue and run workers in a separate tier when queue latency warrants it. Do not rely on an in-process queue on one web node: that node can disappear during a deploy or outage. Make jobs idempotent where possible, record retries and failures, and monitor the age of the oldest queued job.

Uploads and generated files

Store uploads, exports, and other durable artifacts in shared object storage or a durable block-storage service. Local VPS disks are appropriate for temporary files only. Ensure every node can read an object created by another node, and define retention, backup, and deletion behavior before moving production traffic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Persistent connections

Action Cable or another persistent-connection service requires an explicit adapter and routing plan. Decide where connections terminate, how broadcasts reach every connection, and what happens when a node is drained. A normal HTTP load-balancing rule is not sufficient by itself for long-lived sockets.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Configure the external load balancer

Use a private network between the load balancer and nodes where the provider supports it. Expose only the balancer publicly when possible, restrict node firewall rules to balancer and administration addresses, and terminate TLS at a controlled point.

Health checks that prevent bad routing

Create a lightweight readiness endpoint and have the balancer check it at a useful interval. A robust readiness decision covers:

  • Rails boot completed and the release is the intended version.
  • Database connectivity works, with a short timeout.
  • The required cache or session dependency is reachable.
  • Migration state is compatible with the application code.

Do not make a health check perform an expensive report query or depend on a nonessential third-party API. Return “not ready” while a node is booting, migrating, or being drained so new requests go elsewhere.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do you need a load balancer for two servers?

For two production Rails nodes, yes: use an external load balancer or reverse proxy rather than asking Rails to distribute traffic. It provides one stable endpoint, health checks, TLS policy, connection draining, and a place to remove a failed node. A DNS round-robin record cannot reliably detect an unhealthy process and leaves clients caching an unavailable address.

Deploy the same release to every VPS

Build one immutable container image and promote the same image digest to all web nodes. This prevents “works on node A” drift caused by different gems, operating-system packages, or environment variables.

Kamal and the Rails 8 deployment path

Rails’ current getting-started guidance describes Kamal as a Docker-based deployment tool that can release with zero downtime and requires an Ubuntu LTS server; the guide names Hetzner and DigitalOcean as example hosts. The Rails 8 announcement describes Kamal 2 targeting a set of server IP addresses over SSH. Thruster can provide asset acceleration, caching, compression, and automated SSL support in that stack. Treat these as deployment capabilities to configure and verify, not as substitutes for database or storage planning.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

A first-time server bootstrap uses the documented kamal setup workflow. Keep the resulting configuration, image digest, SSH access, registry credentials, and secrets under controlled administration. Never bake production secrets into the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rolling release procedure

  1. Build and scan the image, then record its immutable digest.
  2. Run a compatibility check for database changes. Prefer additive, backward-compatible schema changes before code that depends on them.
  3. Drain one node at the load balancer so existing requests can finish.
  4. Deploy the image, apply the controlled migration step if required, and warm the application and assets.
  5. Wait for readiness checks to pass, then send a small amount of traffic to the node.
  6. Inspect error rate, P95/P99 latency, logs, CPU, memory, and database waits.
  7. If healthy, return the node to service and repeat for the remaining nodes.
  8. If unhealthy, keep the node drained and roll back to the previous image before proceeding.

A blue/green release keeps the old fleet serving while a fully prepared new fleet is tested. It can shorten rollback time, but database changes still need backward compatibility because both application versions may run during the switch.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test capacity and failure behavior

Load-test before and after adding nodes with traffic proportions that resemble production. Include cache misses, authenticated sessions, writes, uploads, slow downstream responses, and background jobs; a benchmark of only a cached homepage is not a capacity plan.

Scenarios worth practicing

  • Remove one node while traffic continues and confirm the balancer drains it without elevated errors.
  • Kill a Puma process and verify supervisor or container orchestration restarts it and readiness prevents premature routing.
  • Make the cache unavailable briefly and confirm the chosen degraded behavior is safe.
  • Restore a database backup into an isolated environment and measure recovery steps.
  • Simulate a failed migration and verify the release can be stopped or rolled back.
  • Allow a queue to build, then confirm worker scaling and retry policies clear it without duplicate side effects.

Rails guidance recommends load testing and allows A/B testing tuning across server groups. Use that approach to compare Puma settings or a new image while retaining a control group.

Choose vertical scaling, more nodes, or a managed platform

Adding nodes is not automatically better than enlarging one VPS. Make the decision against failure risk, bottlenecks, and operational capability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision Advantages Costs and risks Best evidence
Scale a single VPS vertically Simple networking, fewer deployments, and no cross-node session problem. A larger single failure domain; a hard ceiling on CPU, memory, and connection capacity; maintenance can interrupt all traffic. One node is saturated while the application remains easy to operate and database demand is manageable.
Add identical VPS nodes More web CPU and memory, node-level fault tolerance, and rolling deploys. Requires a load balancer, shared state, image consistency, connection budgeting, and tested failover. Web-tier saturation is the measured limit and a second node increases throughput in a controlled test.
Use a managed platform or managed services Potentially simpler networking, backups, failover, observability, and deployment workflows. Less control, provider-specific limits, recurring service cost, and a need to verify geographic placement and support boundaries. Your team cannot reliably operate database failover, backups, monitoring, or a load-balancer tier alone.

When comparing providers, inspect operational ownership, private-network and load-balancer support, database backup and failover procedures, rollback workflow, observability, geographic options, predictable pricing, and the maximum CPU, memory, and connection limits of each plan. Do not compare advertised web-server counts without comparing the database and storage limits that constrain the whole application.

Troubleshoot common multi-VPS failures

Symptom Likely cause Checks and corrective action
Users are logged out when requests switch nodes Sessions are stored locally or secrets differ. Move sessions to the shared store, synchronize credentials and serializer settings, and test a login followed by requests pinned to each node.
Uploads succeed on one node but 404 on another Files exist only on local disk. Use durable shared or object storage; verify read-after-write behavior and permissions from every node.
Database reports too many connections after scaling Every worker pool multiplied with each new node. Apply the connection formula, lower pools or concurrency if appropriate, reserve operational headroom, and increase database capacity only after checking query efficiency.
Latency rises although total CPU falls Database locks, pool waits, cache misses, or a slow downstream service are limiting throughput. Inspect P95/P99, lock and pool-wait metrics, cache hit rate, and dependency timings instead of relying on average CPU.
One node receives traffic during boot or migration Readiness checks test only that a port is open. Include boot, database, cache, and migration compatibility in readiness; drain the node before deployment.
Deploys produce different behavior on different nodes Images, environment variables, or secrets drifted. Promote one immutable image digest, centralize secrets, and compare release identifiers in logs and health responses.
Jobs are duplicated or disappear Workers use separate local queues or jobs are not retry-safe. Use one shared queue, configure acknowledgements and retries, make handlers idempotent, and monitor failed and oldest jobs.

A practical production checklist

  • At least two identical Rails/Puma nodes sit behind an external load balancer.
  • Nodes are replaceable and hold no required session, upload, or queue data locally.
  • Puma workers and threads were selected from measured CPU, memory, throughput, and tail-latency results.
  • The total Active Record pool across all workers and nodes fits below the database limit with operational headroom.
  • Database queries, locks, backups, restore drills, and any replica lag are monitored separately from web metrics.
  • Sessions, cache, jobs, uploads, and persistent connections have explicit shared-service designs.
  • Health checks cover application readiness, database, cache, and migration compatibility.
  • One immutable image and controlled secrets are deployed to every node.
  • Rolling drain, blue/green switching, rollback, node loss, and backup restoration have been rehearsed.
  • Dashboards and alerts include P50/P95/P99 latency, throughput, 5xx rate, CPU, RSS, queue depth, database connections and locks, cache hit rate, storage errors, and replication lag where applicable.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.