The very slow move of POP Forums to .NET Core
I started to work on migrating POP Forums to the new ASP.NET Core more than a year ago, but as the framework and tooling changed a bunch of times, I kind of got tired of trying to keep up, and I let it just hang out for a long time. As I've been engaged at various levels of deep coding at work (usually 0 or 100 mph, never somewhere in between), so goes the mental bandwidth for my little open source project, which has existed in one form or another for more than 16 years. The progress was in spurts, but there was progress. Heck, I even have a CI build now! Here's the timeline:
- In June, I switched over to the RTM bits for Core.
- August was about getting rid of all of the full framework references, which I had kept at that point to handle email sending (SmtpClient) and image resizing (WPF). At that point, I was able to defer mail to MailKit, and resizing to ImageSharp (which was previously called ImageProcessor Core), so the whole thing runs on Core now.
- I also moved some of the unit tests over, but I don't have the controllers covered yet. There are two reasons for that, one of which is that I haven't decided where the controllers should live, and also because they're the messiest part of the app. They desperately need refactoring.
- The background tasks are all safe now to run across many instances. The email, award calculation and search indexing all work on proper queues now. Session updating doesn't, but it's transient data where concurrency is unimportant. For the moment, these processes still run in the context of the web app itself, but they don't have to. It should be easy enough to drop them into a WebJob, service, worker role, whatever. They also now report in with a heartbeat to the database so you can see in admin when they last ran, and from what instance.
- In September I started going deeper into the authentication and authorization bits, now that we're free of FormsAuth and all of that. I'm not entirely sure that I'm "done" there, but because you can now wire up claims auth by default, you can have more than one identity in an ASP.NET app. (You could before, but the mix of various frameworks made this world difficult.)
- I also wrote a new Redis cache provider in the AzureKit project, and it's modeled conceptually at least after what StackOverflow does. I use a 2-level cache where the local instance will check for the data in memory, and if it isn't found, go to the central Redis cache. To invalidate across all instances, the local instance will listen to the Redis messaging for invalidation signals. Redis is pretty awesome.
- I started, but just finished, new search plumbing to use Azure Search, also in the AzureKit project. It was pretty easy to swap out a few parts via dependency injection to replace the old, works-just-barely SQL-based search I wrote a billion years ago. Azure Search is awesome, but I'm not sure I'll use it in my own sites. It's way too expensive, priced the way they used to do SQL Azure... based mostly on storage instead of throughput.
That's the year in review, but what's next?
- SignalR needs some attention, because the Core version isn't done and it's still a somewhat moving target. I also don't have it piping in to a backplane so it can message to other instances and their respective clients, so it won't work multi-instance yet. There is no real-time updating of the Q&A style forums yet (Q&A as in StackOverflow), so that needs to be added. SignalR provides the messaging to inform a reader of new posts. Everyone loves SignalR, but sometimes it seems like it's the neglected step-child of the .NET world. I hope that's not the case.
- I desperately need to refactor the controllers in the app, as well as the unit testing. I imagine that this will be easier than before, since a controller isn't nearly as coupled to HttpContext as it used to be.
- I've already laid the ground work for the email all users functionality to reference a single instance of the email, instead of writing out the email times number of users.
- There are a number of other miscellaneous optimizations in the backlog.
- Still waiting for the dust to settle on the .csproj vs. .xproj thing, and then Visual Studio 2017.
- I'd like to explore some way to simply add a reference to the forums, and bam, you have the area.
The goal for Core was always to have functional equivalency, and position the codebase in a broader sense for improvements and new features. For example, I'm sure there's a case to be made for the use of a modern client framework, in the admin area at the very least, and probably around posting. There's room for innovation there. I don't have dates for any of this... but I want to use the new version in one of my sites this year.