The most recent project I’ve delivered has just gone live, and it’s a hybrid cloud/on-premise architecture which is becoming the norm at one of my clients. It’s a simple Web site, that needed to be delivered rapidly to make good on a sales promise, and the hybrid nature of the service layer enabled us to build and deploy very quickly (three weeks from “can you?” to “it’s live” – at an enterprise where the main product has a three-month release cycle).
The architecture is very simple:
- Front end – not-quite-a Single Page App, rendered by ASP.NET MVC, with navigation done client side with a simple jQuery implementation (rather than a full-blown framework like AngularJS);
- Back end – hybrid cloud/on-premise, with new data stored in Azure Table Storage, and existing on-premises services surfaced through Azure Service Bus Relay.
Initially the app is rolling out to one client. It’s expected to gain momentum quickly, but currently we’re getting all the performance and uptime we need from two Small-sized Azure Web Roles. When the site went live, I looked it up on my dev laptop to check out production performance, and I got to thinking about Single Page Apps, fat clients and thin servers.
When I browse to the site, ASP.NET MVC renders a single page of HTML, and as I’m navigating through pages, I’m really just hiding and unhiding various bits of HTML with jQuery. When I enter some data the validation is done with jQuery Validate, and when the page needs extra data, it’s an AJAX call to an API. Apart from the initial GET request and the final POST request, everything in between is client side, so all the work is being done on my laptop, and I’m the client so that’s the right place for all the work to be done – why should a central server need to do validation and UI logic on behalf of multiple clients, who can all do it themselves?
The Azure node that served my page is running a single core at 2.1GHz, with less than 2Gb of RAM. I’m using a relatively well-specced dev laptop, with 4 cores at 2.5GHz and 16Gb of RAM, but I’d say the majority of clients are going to have a better spec than the server. In fact, the next generation mobile phones and tablets are likely to be more powerful than our Web servers. So we should be pushing as much processing out to the client as possible - they’ve got better kit than we have.
It’s a pretty good argument in favour of the SPA approach.