Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

Your company is moving databases to a managed cloud service and considering serverless database offerings that scale connections and compute automatically. What long-term questions would you ask about cost, connection management and exit?

Before committing to a serverless or managed database, I would ask how the bill grows across compute, storage, I/O and connections over several years, how the service handles connections and what that means for our HikariCP pools, which features would lock us in and how we would leave, and how it behaves on cold starts, failovers and maintenance. Then I would prove the answers with a pilot under production-like load, while keeping our code on standard JDBC and SQL.

Why this question is asked

A database platform decision outlives the people who make it. A service that is cheap and convenient in its first year can become the largest line on the cloud bill in its fifth, or a trap that takes a year of migration work to escape. Interviewers ask this question at senior levels because it tests whether we look past the sales demo to the long-term costs, the operational behaviour and the exit. In this answer, we will recap what changes when the database becomes a managed or serverless service, then go through the four groups of questions a senior engineer asks: cost, connections, lock-in and exit, and behaviour under failure. We finish with how a pilot turns these questions into evidence.

1What Changes When the Database Becomes a Service

With a managed database, the cloud provider runs the engine for us: it patches it, takes backups and handles replicas. A serverless offering goes one step further. Instead of choosing a machine size, we set a range, and the service adds or removes compute as load changes, sometimes all the way down to zero when nobody is using it. Many such services also put a connection proxy in front of the engine, so that thousands of short-lived clients do not each open a real database session.

These features are attractive, but each one moves a decision from our team to the provider. Pricing, scaling speed, how connections are multiplexed and what happens during a failover are now rules we cannot change, only learn. So the senior questions are about those rules, asked before we depend on them.

2Question One: How Does the Bill Grow?

The first question is how the service charges, dimension by dimension. Compute may be billed per second of capacity units, storage per gigabyte month, I/O per million requests, and some offerings charge for proxy or connection capacity separately. Backups, cross-region replicas and data transfer out are often extra. We want every dimension written down, because the one we forget is usually the one that grows.

Then we model growth, not just today. Suppose our main database today handles 2,000 queries per second and stores 500 GB, and the business expects traffic to double every 18 months. We take the provider's prices and project five years: a pay-per-request I/O charge that is small today can become the dominant cost when traffic is eight times larger, while a fixed-size instance with reserved pricing grows in steps. Serverless pricing is usually best for spiky or idle workloads and often worse for steady, high load, so we compare both against our real traffic curve.

Cost dimensions to model over five years
DimensionWhat to askWhy it matters later
ComputeBilled per second, per unit, minimum and maximum?Steady high load may cost more than a fixed instance
StoragePrice per GB month, is it billed on peak or current size?Data rarely shrinks; growth compounds
I/OCharged per request or included?Grows with traffic, often the surprise line
Connections and proxySeparate charge for the proxy or connection capacity?Many small services multiply it
Backups and transferRetention, cross-region copies, egressExit and disaster recovery depend on them
We project each line with the expected traffic growth, not just today's numbers.

Autoscaling also makes the bill less predictable, so we ask which limits and alerts stop a runaway query or retry storm from scaling compute overnight.

3Question Two: Who Owns the Connections Now?

Our Java services hold connections in a HikariCP pool: a set of open database connections that threads borrow and return, so that no request pays for opening a new one. A provider proxy changes the picture. If the service multiplexes many client connections onto fewer engine sessions, our pools may no longer map one to one onto database work, and the database limit we size against becomes the proxy's limit instead.

So we ask how the proxy pools: per session, per transaction or per statement. Transaction-level multiplexing is efficient, but it breaks anything that relies on session state between transactions, such as session variables, advisory locks, temporary tables and sometimes server-side prepared statements. We also ask about idle timeouts. If the proxy drops idle connections after, say, 10 minutes, HikariCP's maxLifetime and keepaliveTime must be set below that, or threads will borrow connections that are already dead.

YAML
spring:
datasource:
hikari:
maximum-pool-size: 10 # sized for our work, not for the proxy's headline limit
max-lifetime: 540000 # 9 minutes, below an assumed 10 minute proxy idle timeout
keepalive-time: 120000 # 2 minutes, keeps idle connections known to be alive
connection-timeout: 3000 # fail fast instead of queueing for 30 seconds

4Question Three: How Do We Get Out?

Every managed service offers something that is not in the standard engine: a special storage layer, a proprietary replication feature, a vendor SQL function or an SDK that replaces the JDBC driver. Each one may be useful, but each one also raises the cost of leaving. The question is which of these features we would actually use, and what moving back to a standard PostgreSQL or MySQL would take.

We want concrete answers: can we take a full logical dump in a standard format, can we replicate out to a self-managed engine with minimal downtime, how long would exporting 5 TB take, and does the provider charge for that transfer? A useful rule is to write the exit plan before signing up and to review it once a year. If the plan says 'impossible without a six-month rewrite', we have learned the real price of the feature.

5Question Four: How Does It Behave on a Bad Day?

Autoscaling and scale-to-zero have a cost in latency. When a database scaled to zero receives its first query, it must start compute again, which can take seconds. For a nightly reporting job that is fine; for a checkout API with a 300 ms budget it is not. We ask how fast it scales up under a sudden spike, how long a cold start takes, and whether we can set a minimum capacity to avoid it.

We also ask what happens during failover and maintenance: how long writes are unavailable, whether connections are dropped, and whether the proxy hides the switch from clients. Our applications must handle a dropped connection with a clean retry of the whole transaction, so we test that path deliberately instead of discovering it during the provider's first maintenance window.

6Turning the Questions Into Evidence With a Pilot

Answers from a sales call are claims; a pilot turns them into numbers. We pick one real service, replay production-like load against the candidate, including the daily peak, a spike and an idle period, and measure latency, errors, scaling behaviour and the actual bill for the test period. We also trigger a failover on purpose and watch what our pools and retries do.

Throughout, we keep the application on standard JDBC, the standard driver where possible, and portable SQL. That is what keeps the exit question honest: if the service disappoints after two years, we change a connection URL and run a migration, instead of rewriting data access code.

Step throughFrom questions to a decision
  1. Write down pricing for every dimensioncompute, storage, I/O, connections, backups, transfer
  2. Project cost over five yearswith our expected traffic growth
  3. Read the connection and failover rulesproxy mode, idle timeouts, failover time
  4. Write the exit planexport format, replication out, transfer time
  5. Pilot one service with production-like loadpeak, spike, idle, forced failover
  6. Do the measured numbers meet our targets?
    YesAdopt, keep code on standard JDBC and SQLNoStay on a fixed managed instance or try another option

6 steps in order. Play them, or step through them one at a time.

The pilot replaces claims with measurements before we commit.

7Follow-up questions

Is a serverless database always cheaper?

No. It is usually cheaper for workloads that are idle much of the time or very spiky, because we stop paying when nothing runs. For a steady, busy workload, paying per second of capacity or per I/O request often costs more than a reserved fixed instance. That is why we model our own traffic curve over several years rather than trusting the general claim.

Do we still need HikariCP if the provider has a connection proxy?

In a long-running Java service, yes, usually. Opening a connection through a proxy still costs a network round trip and a handshake, so an application pool keeps latency low. What changes is the sizing and the timeouts: the pool should be small, match the proxy's rules for session state, and have maxLifetime below any idle timeout the proxy enforces. Short-lived functions that cannot keep a pool are where the proxy matters most.

8Conclusion

In this answer, we saw that a managed or serverless database moves decisions about pricing, scaling, connections and failover from our team to the provider, so the senior questions are about those rules. We model cost dimension by dimension over years, learn how the proxy handles connections and size our pools to match, write an exit plan before we depend on proprietary features, and test cold starts and failovers. A pilot with production-like load turns these questions into measurements, and standard JDBC and SQL keep the exit open.

What to say in the interviewAbout 80 seconds aloud

Open with

I would ask four groups of questions. First, cost: how compute, storage, I/O, connections, backups and data transfer are priced, and what that looks like over five years with our expected growth, because serverless pricing is great for idle or spiky load and often worse for steady high load.

Then, if they want more

Second, connections: does the service put a proxy in front of the engine, does it multiplex per transaction, which breaks session state like advisory locks and session variables, and what idle timeouts it enforces, so I can set HikariCP's maxLifetime and keepalive below them and keep pools small.

Third, exit: which features are proprietary, can I take a standard dump or replicate out to plain PostgreSQL or MySQL, how long would it take and what would transfer cost. I would want an exit plan written before we sign up.

Fourth, bad days: cold start time after scale to zero, how fast it scales on a spike, how long failover and maintenance interrupt writes, and whether connections drop.

Then I would run a pilot on one real service with replayed production load, including a forced failover, measure latency and the real bill, and keep the code on standard JDBC and SQL so that leaving stays a configuration change, not a rewrite.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
java.sql, package documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your company is moving databases to a managed cloud service and considering serverless...": https://scrivio-interview-library.netlify.app/databases/jdbc/b6a1bdca4a/