Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Scale Ruby on Rails Applications Across Multiple VPS Servers

Learn how to run stateless Rails/Puma nodes behind a load balancer, budget database connections, share sessions and files, tune workers and threads, and deploy safely across multiple VPS servers.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run two or more identical, stateless Rails/Puma nodes behind an external load balancer, while keeping the database, cache and session store, job queue, and uploaded files on shared or dedicated services. Add a node only after measurements show that web CPU or memory is the bottleneck; extra VPS instances cannot repair a saturated database or inefficient queries.

The target architecture

Scaling across VPS servers means distributing independent Rails application processes across several machines. Each web node should be replaceable: a request may arrive at any node, and losing one node should reduce capacity rather than lose sessions, uploads, or queued work.

As an Amazon Associate I earn from qualifying purchases.

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.

A practical production topology contains these layers:

  1. External load balancer or reverse proxy: terminates TLS when appropriate, performs health checks, and distributes requests to ready nodes.
  2. Identical Rails/Puma nodes: run the same immutable application image and configuration. Start with two nodes so maintenance or a single-node failure does not require an outage.
  3. Primary relational database: PostgreSQL or MySQL sized for the combined connection demand of every Puma process, plus administrative headroom.
  4. Shared cache and session service: keeps state available regardless of which node receives a request.
  5. Background-job workers: consume a shared queue independently from web traffic when queue latency or job volume justifies a separate tier.
  6. Durable file storage: stores uploads, exports, and generated assets outside a node’s ephemeral disk.
  7. Central observability: aggregates logs, metrics, traces or error reports, and alerts from every node and dependency.

Keep the load-balancing decision outside Rails. Rails’ multiple-database guidance states that primitive load balancing at application scale should be handled by the surrounding infrastructure, not by the framework itself.

#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.

Decide whether adding a VPS is the right fix

Measure before changing topology. A second web server helps when application CPU, resident memory, or request concurrency is exhausted on the current node. It does not fix slow SQL, database locks, an undersized connection limit, cache misses, or a job queue that is backed up by long-running work.

Observed limit Likely first action Why adding a web node may not help
Web CPU remains saturated while database wait is low Benchmark another Puma node and distribute traffic More nodes can add useful application capacity
Resident memory is near the VPS limit Reduce Puma processes, tune threads, or move to a larger machine; then test horizontal scaling Cloning an oversized process multiplies memory pressure
High database wait, locks, or connection refusal Optimize queries, indexes, pool sizing, and database capacity Every new node adds more database demand
High queue depth with healthy web latency Add or resize background-job workers Web nodes do not consume queued jobs unless configured to do so
Slow uploads or generated files Move files to durable shared or object storage Local disks are isolated to one node
Tail latency rises only during bursts Inspect saturation, queueing, cache hit rate, and load-balancer behavior Average response time can hide a capacity cliff

Compare vertical and horizontal scaling against the same criteria: implementation effort, single-node failure risk, database bottlenecks, tail latency under load, and rollback complexity. A larger VPS is simpler to operate but leaves a larger failure domain. Multiple smaller nodes improve maintenance and capacity options, but require a load balancer, shared state, coordinated releases, and disciplined monitoring.

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

Make every Rails node stateless

Horizontal scaling works only when a request does not depend on a particular process’s memory or a machine’s local disk.

Sessions and cache

Use a shared session store and cache service. Do not rely on an in-process cache or a file-backed session directory that exists on only one VPS. Configure all nodes with the same session encryption settings and expiration policy. If a node is removed, users should remain authenticated and cache invalidation should behave consistently.

Uploads and generated files

Store user uploads, report files, and other durable artifacts on shared or object storage. Local storage may be used for temporary processing, but the final artifact must be copied to storage available to every node. Define retention, encryption, access control, and backup policies separately from the web deployment.

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.

Background jobs

Point every job producer and worker at the same queue backend. Run workers as a separate process or tier when jobs compete with web requests for CPU and memory. Monitor queue depth, oldest-job age, retry counts, and dead-letter or permanently failed jobs.

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

Persistent connections

If the application uses Action Cable or another persistent-connection service, choose its adapter and routing deliberately. The load balancer must support the required upgrade and timeout behavior, and all nodes must be able to publish and receive the same connection events. Test reconnects during a node drain rather than assuming ordinary HTTP balancing is sufficient.

Place and configure the load balancer

The load balancer is the traffic-distribution and node-draining layer. For two Rails servers, a load balancer is strongly recommended: DNS round-robin alone cannot reliably remove an unhealthy node, coordinate draining, or provide consistent health checks. A reverse proxy on a dedicated VPS can serve the role for a small deployment, while a managed network load balancer reduces the amount of infrastructure you must patch and monitor.

Health-check design

Create a lightweight readiness endpoint and distinguish it from a deep diagnostic endpoint. Readiness should return success only after the application has booted, required configuration is present, the migration state is acceptable, and essential dependencies are reachable. A database check that runs an expensive query on every probe can become a new source of load; use a minimal, bounded check.

  • Return a failure while a node is booting, draining, or running an incompatible migration.
  • Use a short timeout and require more than one successful probe before sending production traffic.
  • Remove a node after consecutive failures, but allow enough delay for transient network faults.
  • Use connection draining so in-flight requests finish before a process is stopped.
  • Verify that the balancer preserves the client information your application needs and enforces the intended TLS policy.

Network boundaries

Expose only the load-balancer entry point publicly when possible. Place Rails nodes, the database, cache, queue, and storage endpoints on a private network or restrict them with firewall rules. Permit database access from the application-node security group rather than from the entire internet. Keep administrative SSH access separate, audited, and limited to the deployment and operations paths.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Tune Puma workers and threads per node

Puma is Rails’ default application server. Its workers setting creates separate processes; threads controls concurrent work within each process. More workers usually increase CPU parallelism but multiply memory use and database pools. More threads can improve throughput for I/O-bound requests, yet increase contention and the number of simultaneous database connections.

Setting What it changes Main cost or risk
Workers Process-level parallelism and isolation Each process has its own Ruby heap and Active Record pool
Threads Concurrent requests handled by one worker Higher contention, memory use, and potential database demand
YJIT Can improve Ruby execution on supported versions Additional memory and version-specific behavior must be validated
jemalloc May reduce fragmentation in threaded Puma workloads Benefit depends on the actual Ruby and VPS image

There is no universal worker or thread count. A worker count near the available CPU cores is a starting hypothesis, not a guarantee. Shared VPS platforms can report misleading CPU counts, so WEB_CONCURRENCY=auto may select too many workers. Set an explicit value when the provider’s virtual CPU allocation or memory limit makes automatic detection unreliable.

A repeatable tuning procedure

  1. Record the current node’s CPU saturation, RSS memory, request throughput, P50, P95 and P99 latency, error rate, database wait time, and connection usage.
  2. Choose a conservative worker and thread configuration that fits comfortably within the node’s memory limit. Include memory for the operating system, proxy, logging agent, and deploy process.
  3. Change one variable at a time. For example, hold workers constant while testing a lower and higher thread count, then test workers separately.
  4. Load-test representative read, write, authenticated, upload, and error paths. Use production-like payload sizes and cache conditions.
  5. Keep the configuration that improves useful throughput without unacceptable P95/P99 latency, garbage-collection pauses, error rate, or database saturation.
  6. Repeat the test on the actual VPS image. Results from another CPU model, storage class, or noisy neighbor environment do not transfer automatically.

Rails’ generated Puma configuration uses three threads by default, but that is a configuration default rather than a capacity claim. Treat it as a safe starting point to measure, not a target for every workload.

Budget Active Record connections across the cluster

Active Record pools are configured per application server process. Rails’ default pool limit is five unless you change it. The database sees the sum of pools from every Puma worker on every node, not merely the number of VPS machines.

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

Use this planning formula:

maximum application connections = nodes × workers per node × pool size

For example, three nodes with four workers each and a pool size of five can request up to 60 application connections before accounting for migrations, consoles, monitoring, job workers, replicas, or failover tools. Leave explicit headroom for those activities and for short-lived connection spikes. Ensure the database’s connection limit, proxy limits if used, and operating-system resources all support the budget.

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

Symptoms of an exhausted pool or database

  • Requests wait for a connection even though Puma threads are available.
  • New nodes increase queueing and errors instead of throughput.
  • Logs report connection timeouts or a database connection ceiling.
  • Database CPU, locks, or I/O remain high while web CPU is moderate.

Reduce unnecessary concurrency, optimize slow queries, add indexes where justified, and resize the database before multiplying web nodes. Read replicas or horizontal sharding can address specific read or data-growth patterns, but introduce replica lag, routing rules, failover procedures, backup requirements, and operational complexity. Adopt them only when measurements show that those trade-offs are necessary.

Deploy the same release to every node

Build one immutable container image and promote the same image digest to every web server. Do not compile different code or dependencies independently on each VPS. Keep secrets in the deployment secret mechanism, not in the image or repository.

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

Rails’ current deployment guidance describes Kamal as a Docker-based tool that can release with zero downtime and requires an Ubuntu LTS server. Rails 8’s announcement describes Kamal 2 targeting a set of server IP addresses over SSH; Thruster can provide asset acceleration, caching, compression, and automated SSL support. Verify the exact versions and supported operating-system releases in your deployment environment before production use.

Rolling-release sequence

  1. Build and scan the image once, then record its digest.
  2. Run automated tests and a migration compatibility check. Database changes must be backward compatible with both the old and new application code during the rollout.
  3. Mark one node draining in the load balancer. Stop new requests while allowing in-flight requests to complete.
  4. Deploy the image, required configuration, and dependencies to that node. Run migrations in a controlled, single-owner step rather than concurrently on every node.
  5. Start Puma and wait for boot, readiness, and warm-up checks. Exercise representative endpoints and confirm logs contain no new errors.
  6. Send a small amount of traffic to the node, compare latency and error metrics with the unchanged nodes, and continue only when they are healthy.
  7. Repeat the drain, deploy, warm-up, and verification sequence for each remaining node.
  8. Keep the previous image available for rollback. If the database change is not backward compatible, stop the rolling release and use a planned blue/green migration strategy instead.

A blue/green deployment keeps the current environment serving while a complete replacement environment is validated. It can shorten rollback time, but requires capacity for both environments and careful handling of shared migrations, queues, scheduled jobs, and persistent connections.

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

Measure the cluster instead of guessing

Track both averages and tails. P50 is the median latency; P99 is the point below which 99 percent of requests fall, so only one percent are slower. Tail latency often reveals queueing and saturation long before an average looks alarming.

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.
  • Requests per second and successful request rate
  • P50, P95, and P99 latency by endpoint and status code
  • 4xx and 5xx rates, timeout counts, and load-balancer rejection counts
  • CPU saturation, RSS memory, garbage collection, and disk I/O per node
  • Puma worker utilization and thread or connection wait time
  • Database CPU, locks, slow queries, pool usage, and connection refusals
  • Cache hit rate, eviction rate, and dependency latency
  • Queue depth, oldest-job age, retries, and failed jobs
  • Upload-storage latency, capacity, and error rate
  • Replica lag when read replicas are present

Load-test before and after adding nodes, using realistic mixes of reads, writes, authenticated requests, uploads, and background work. Rails guidance also supports A/B testing tuning across server groups: run different configurations on controlled groups, compare the same metrics, and keep the better result only when the workload and traffic split are comparable.

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.

Plan node removal and failure recovery

Practice failure procedures while the system is healthy. Remove one node from service, confirm that the remaining nodes handle traffic, and then restore it using the normal deployment path. Simulate a lost node, a failed health check, a database restore, and a release rollback. Record who performs each action and which metrics determine whether to continue or abort.

Symptom Checks Corrective action
Users are logged out when traffic moves between nodes Session-store configuration, encryption keys, cookie domain, and expiration Use one shared session configuration and remove node-local sessions
Uploads exist only on the node that received them Storage adapter and write path Persist final files to shared or object storage
New nodes produce database timeouts Total pool calculation, database connection limit, and job-worker pools Lower concurrency, increase justified capacity, or optimize queries
One node receives traffic while another is unhealthy Health-check URL, timeout, proxy status, and drain behavior Fix readiness semantics and configure consecutive-failure removal
Latency rises after increasing threads Database wait, lock time, CPU contention, and RSS memory Reduce threads or workers and retest with the same workload
Rollback fails after a migration Whether old code can read the new schema and whether jobs are compatible Use expand-and-contract migrations and a tested rollback plan
Action Cable clients disconnect during deploys Connection draining, adapter, proxy upgrade, and timeout settings Route persistent connections explicitly and test reconnect behavior

Choose infrastructure ownership deliberately

A self-managed VPS cluster gives direct control over operating-system versions, private networking, placement, and predictable machine pricing. You also own patching, load-balancer redundancy, database backups, failover, storage durability, alerting, and restore drills. A managed platform may reduce that operational burden, but evaluate its limits and lock-in before moving production traffic.

Decision area Questions to answer
Operations Who patches servers, rotates credentials, responds to alerts, and replaces failed nodes?
Networking Is there a redundant load balancer, private network, firewall policy, and suitable geographic placement?
Database Are backups automated and restorable, and is failover documented and exercised?
Deployment Can one image be promoted to every node with health checks, draining, and fast rollback?
Observability Can you correlate requests, Rails errors, Puma saturation, database waits, and queue latency?
Capacity What are the plan’s CPU, memory, disk, connection, bandwidth, and storage limits?
Cost What is the recurring total for nodes, balancer, database, storage, backups, monitoring, and support?

Do not compare server hourly prices alone. Include redundancy, backup storage, observability, engineering time, and the cost of an untested restore or prolonged outage.

A practical first rollout

  1. Capture a baseline under representative load, including P50/P95/P99, throughput, errors, CPU, memory, database waits, and queue depth.
  2. Move sessions, cache, uploads, and jobs off node-local state.
  3. Set an explicit Puma configuration and calculate the total Active Record connection budget.
  4. Provision two equivalent Ubuntu LTS nodes and place them behind a health-checking load balancer.
  5. Deploy one immutable image to both nodes, verify readiness, and test node removal.
  6. Run the same load test against one node and two nodes. Confirm that the bottleneck moved as expected rather than simply shifting to the database.
  7. Document rolling deployment, rollback, backup restoration, and failure drills before increasing traffic or adding more nodes.

Continue adding nodes only while the measurements show useful capacity gains and the database, cache, queue, storage, and operational processes remain within their tested limits.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.