SUSE Linux Enterprise Server (SLES) is now available for Raspberry Pi

Ok, so it’s not serverless, but the Raspberry Pi 3B is available for just £32, which is pretty low cost. SUSE Linux have just announced that they’ll be supporting their Enterprise Server v12 SP3 on the tiny computer. The Pi has become very popular not only as a home hacker board, but as a media streaming box, and in lots of factories and warehouses where its lack of moving parts makes it ideal for use in dusty environments. If you’re happier with a supported version of  Linux which is guaranteed to stay the same for 3-4 years, rather than regularly doing “apt-get and hope”, this might be for you. At the moment this is only for the Pi 3B, additional builds/support for other models like the new 3B+ and the compute module should follow soon. If you’re stuck with what to do with your Raspberry Pi, there’s a ton of good suggestions here on weekend projects with a raspberry pi

You’re doing HttpClient wrong

Today I learned something that shocked me to my core. The following piece of c# code is wrong: using (var client = new HttpClient()) { // client.GetAsync(…); } Why is this wrong? Superficially, HttpClient implements IDisposable, and if you’re like me (and I suspect 90% of all .Net developers) you’ve been taught to diligently call Dispose() on anything that implements IDisposable. Except that HttpClient is a bit different, it’s actually designed to be a shared object, and thread-safe.  If you come up against problems with TCP socket exhaustion, you’ve probably got loads of connections in TIME_WAIT state, and it could be due to this simple issue.  The use of HttpClient in a using block is so common across the internet, and in Microsoft’s documentation that it was a real shock that this was wrong. What should I do instead? You can instead just instantiate HttpClient once, either as a class-level static, or pass it around in your IoC container.  You could come up against some issues with setting properties such as Timeout after instantiation, and it may not respect changes to DNS but if you’re having problems with using too many sockets this is the only solution. References: https://stackoverflow.com/questions/15705092/do-httpclient-and-httpclienthandler-have-to-be-disposed https://docs.microsoft.com/en-gb/azure/architecture/antipatterns/improper-instantiation/


So what exactly is serverless computing?

What does serverless mean? Wikipedia defines Serverless as “a cloud computing execution model in which the cloud provider dynamically manages the allocation of machine resources“.  It’s sometimes referred to as Functions-as-a-service (FaaS). The term comes from the Serverless Framework. So how does it work if there’s no server? Ok, all is not quite as it seems. There is still a server or in fact lots of servers. There is no magic, but the beauty is that you don’t need to worry about them.  You don’t pay for them or have to maintain them.  All that pain is shifted to the cloud service provider.  It’s similar to shared web hosting – you don’t have a server to yourself but instead, you share one with several other people.  It’s up to the provider to decide how many clients they can support on each server.  On the flip-side, you don’t get to decide what software should be installed on the servers, you’re stuck with the functionality provided.  The provider has gone out of their way to ensure you can’t even see the server. What’s the point? Why should I use it? Well, it means that you won’t have to worry about operating systems, patching, rebooting and most of your day-to-day maintenance. Serverless architectures work well as a set of microservices, or as a glue between layers of an application.  They tie in well with messaging frameworks and can often be triggered by multiple means such as queues, files, HTTP calls, and database triggers. Serverless normally support multiple languages such as .NET, Javascript,… Read More