The Hybrid Cloud Trap: Why Your Norwegian Stack Needs Local Iron
Let’s be honest. The "all-in on AWS" strategy is starting to crack. If you are a CTO or Lead Architect operating out of Oslo or Stavanger in 2014, you have likely noticed two things: your monthly bill for Provisioned IOPS is skyrocketing, and the speed of light is still a stubborn constant. A request round-tripping from a user in Bergen to us-east-1 (Virginia) or even eu-west-1 (Dublin) involves inescapable physical latency.
I recently audited a high-traffic media portal covering the Sochi Olympics. They were hosted entirely on public cloud instances in Ireland. Great for scalability, terrible for dynamic content load times in Scandinavia. Their Time To First Byte (TTFB) hovered around 200ms before the application even started processing PHP. That is unacceptable.
The solution isn't to abandon the cloud. It's to stop treating it as a religion and start treating it as a utility. We need a hybrid strategy: massive object storage where it's cheap, and raw, high-performance compute where your users are.
The Latency Mathematics: Why Geography Matters
Latency is the silent killer of conversion rates. In Norway, our fiber infrastructure is robust, thanks to the heavy investments by Telenor and Altibox. But routing traffic out of the country introduces hops.
Here is a basic MTR (My Traceroute) report I ran this morning from a standard connection in Oslo to a major US cloud provider:
# mtr --report --report-cycles=10 s3.amazonaws.com
HOST: workstation-oslo Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.1.1 0.0% 10 0.3 0.4 0.3 0.5 0.1
2.|-- lo.oslo-core.no 0.0% 10 1.2 1.5 1.1 2.8 0.5
...
12.|-- 54.239.109.166 0.0% 10 98.5 99.1 98.2 102.4 1.3
99ms average latency. Compare that to a local CoolVDS instance in our Nordic datacenter:
# mtr --report --report-cycles=10 85.x.x.x (CoolVDS IP)
HOST: workstation-oslo Loss% Snt Last Avg Best Wrst StDev
...
4.|-- coolvds-gw.no 0.0% 10 3.1 3.2 2.9 3.5 0.2
3ms. That is a 96ms head start on every single packet exchange. For a MySQL handshake, which requires multiple round trips, this difference compounds into seconds of delay.
Architecture: The "Split-Stack" Model
The pragmatic approach for 2014 is to keep your heavy static assets (images, backups) on S3, but move your database and application logic to high-performance local VPS. This satisfies the Norwegian Personal Data Act (Personopplysningsloven) by keeping sensitive customer data on Norwegian soil—a concern that has become paramount since the Snowden leaks last year.
The Glue: HAProxy 1.5
HAProxy 1.5 was finally released as stable last month (June 2014). This is massive because it now supports native SSL termination. You no longer need to put Stunnel or Nginx in front of HAProxy just to handle HTTPS.
Here is how we configure a CoolVDS node to act as the primary ingress, offloading SSL and routing traffic locally versus to the cloud fallback:
global
log 127.0.0.1 local0
maxconn 2048
user haproxy
group haproxy
# SSL tuning for security (Poodle vulnerability mitigation)
tune.ssl.default-dh-param 2048
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend https_front
bind *:443 ssl crt /etc/haproxy/certs/site.pem
reqadd X-Forwarded-Proto:\ https
default_backend local_nodes
backend local_nodes
balance roundrobin
# CoolVDS instances with SSD
server web01 10.0.0.2:80 check inter 2000 rise 2 fall 3
server web02 10.0.0.3:80 check inter 2000 rise 2 fall 3
# Cloud fallback if local nodes are overwhelmed
server cloud01 54.x.x.x:80 check backup
This configuration prefers your fast, local hardware. If (and only if) your local nodes fail, it routes traffic to the slower cloud backup.
The Storage Bottleneck: HDD vs. SSD
Public cloud providers often obscure the underlying hardware. You get "vCPUs" and "Storage Blocks." But in a database-heavy application (Magento, Drupal, WordPress), I/O is usually the bottleneck, not CPU.
Most standard cloud instances are still spinning rust (HDD) or network-attached storage (NAS), which introduces jitter. At CoolVDS, we use Pure SSD RAID-10 arrays locally. The difference in MySQL transaction throughput is stark.
Pro Tip: If you are running MySQL 5.6 on a Linux VPS, ensure your I/O scheduler is set to 'noop' or 'deadline' rather than 'cfq'. The 'cfq' scheduler assumes rotating platters and tries to optimize head movement, which is wasted cycles on SSDs.
Check your current scheduler:
cat /sys/block/sda/queue/scheduler
[noop] deadline cfq
To change it on the fly without a reboot:
echo noop > /sys/block/sda/queue/scheduler
Data Sovereignty and Trust
We need to talk about the Datatilsynet. Norwegian privacy laws are strict. While the US-EU Safe Harbor framework technically allows data transfer, the political climate is shifting. Relying on a US-owned provider for your core customer database (Personregister) is a business risk.
Hosting locally isn't just about speed; it's about legal insulation. By keeping your primary database on a CoolVDS KVM slice in Norway, you retain full jurisdictional control. We provide the infrastructure; you own the encryption keys.
Implementation Strategy
Don't migrate everything overnight. Start with the database.
- Spin up a CoolVDS instance: Choose a plan with at least 4GB RAM if you are running the LAMP stack.
- Establish a VPN Tunnel: Use OpenVPN to connect your new local DB to your existing frontend.
- Benchmark: Run
sysbenchagainst your current cloud DB and the new local SSD instance. - Migrate: Use
mysqldumpor Percona XtraBackup for the transfer.
The cloud is a powerful tool, but it is not a one-size-fits-all solution. For Norwegian businesses, the winning strategy in 2014 is hybrid: leverage the global cloud for reach, but keep your brain—and your data—local.
Ready to cut your latency by 90%? Deploy a KVM-based SSD instance on CoolVDS today and see what real hardware feels like.