Welcome The Great Russian Firewall

I have just found that my site stefantsov.com can not be opened from Russia. Since I’m not doing anything bad, this was a surprise for me. After digging a bit, thanks to +Fedor, I was able to find the reason behind the blocking.For stefantsov.com I’m using Cloudflare CDN to deliver resources faster all around the world, reduce server bandwidth, get some free optimizations, etc. Cloudflare effectively hides my real IP, delivering all content itself. Currently site’s IP resolves to 141.101.116.129: CLOUDFLARE-EU. In russian blacklist there is some hentai site, that is using Cloudflare as well, resolves to same IP address. It got blocked few days ago, which effectively blocks my site as well.gl hf gg wp no re, да здравствует великий российский файрвол, guys.
[Random In Soviet Russia joke]

Stefantsov Blocked Firewall

 

Google Night Walk in Marseille, France

This is a great piece of art, a nightwalk through the savannah of the night Marseille. This is done using Google Street View engine, but greatly enriched by music, sounds and annotations.

You will usually encounter images like this:

Google Nightwalk Marseille France ArtOne of many sights of the night Marseille

You may love it, you may hate it, but it will not leave you indifferent. Like promised in the very beginning, it will show you the soul of the city. Take a night walk with Google in Marseille, France.

Umbraco 7 MVC performance

Performance always interests me. Now, when I host my sites in Cloud, it interests me even more. Better performance = less money spent.

My current setup: Windows Server 2012 Standard, IIS 8.0, SQL Server 2012 Express, 2 GHz core, 1.5 GB RAM, Umbraco 7.0.3. I have tried first two google pages of “website online stress testing tools” and it’s variations, the best and the only leader there is https://www.blitz.io/, nothing changed here since my previous article. Really great tool.

So, my results (really approximate):

  • ~50 requests / sec takes a 2GHz core
  • ~100 requests / sec takes 10 Mbps
  • ~200 MB RAM per each Umbraco instance (less than 1000 nodes)

More specifics:
I’m testing it on a simple Umbraco site, with less than 1000 nodes. It only have uBlogsy package installed, and my custom .dll with few extensions. Page I’m testing is 2nd level deep in Layout, it have about 10 Partials, but every one of them is CachedPartial with 60 seconds cache time (more than enough for the test). Uncached part of page contains moderate amount of logic. In real world you can’t expect all the code to be 100% optimized and always be perfect. Code happens. But if I remove that code, I get up to 160 hits / second:

Content-only page with no logic at allContent-only page with no logic at all, this is unlikely to happen in real life

 

Here is how same page with absolutely no logic looks when I set my cloud PC to have 2x 2GHz cores (twice as much CPU power):

Content page with no logic, 2 coresSame content page with no logic as above, but this time with 2x cores of 2GHz

 

Back to real life. Page with moderate amount of logic. How will it act on 10 cores?

Server Task Manager 10 CoresWindows Server 2012 Task Manager during stress test, 10x 2GHz cores

 

10 Core Moderate Logic PageStress test image for page with logic, server is 10x 2GHz cores

You can see, Umbraco scales pretty much linear.

Whether this numbers big or not is up to you to decide. Most sites won’t ever experience this many visitors anyway: 50 hits per second translates into up to ~4 000 000 views per day.
And it scales linear with CPU: want 40 000 000 views per day? Throw 9 more cores and you are fine. Want 4 000 000 000 views per day (do such numbers even exist?) and your server can’t scale that high? Scale horizontally: add few more servers and do a load balancing. I’ve never seen this myself, but Umbraco claims it supports load balancing and it works well. Exciting video about Umbraco serving Red Bull Stratos project, how they did it:

 

One more trick to serve many static pages at once: OutputCache. With Umbraco MVC is is really easy to enable and it gives more than 10 times boost. Here is image for 1x 2GHz core and OutputCache enabled:

Umbraco Output Cache Performant ServerUmbraco 7.0.3 MVC with [OutputCache] attribute specified on hijacked route controller action. Server side.

 

Umbraco Output Cache Performant Stress Test[OutputCache] stress test results. 1x 2GHz CPU core.

 

Now this is what I call good performance! Important thing to remember here is network bandwidth. This example alone was generating more than 70 Mbps of outgoing traffic. And stress test is not requesting any resources like CSS, JS or images. If you are about to have this much real users, you’d be using much more bandwidth!

Code:

This is Umbraco route hijacking. In short words, you create a controller class with name that starts with your Document Type alias and ends with “Controller”. It’s Index action is called to display page of this document type. Do whatever you like with it. In our case, apply OutputCache attribute.

Also, like mentioned in comments to this article, one could take a look at Donut Caching, here is a nice article on MVC Donut Caching. It promises to solve caching problems for pages that have changing parts (like Logged In user partial). Would love to hear about successful Donut Cahing use cases on Umbraco.

jStepper: convenient numeric input text plugin

jStepper is a nice and really useful jQuery plugin that, once applied to a text input, only allows digits or numbers to be entered in it.

Setting it up as easy as

Look at jStepper in action at Hearthstone Calculator tool I’ve made recently. Here is the code that I’m using for hscalc:

jStepper homepage is handy, you can see all the options and apply them right away.

Not much else to be said. This tool just works, as intended. You would also like to know that author behind it, +Martin Kruse, is nice and helpful guy. Collaborated well on a little bug I had for my corner case, accepted my pull request.

Visual Studio 2013 is amazing! Browser Link.

Microsoft Visual Studio 2013 is amazing! Whatever I was using before (including vs2012) is just a notepad compared to vs2013. This thing really performs some MAGIC! Magic have official name: Browser Link (+video). I have watched videos of it, heard podcasts of it, etc. But I just had to try it myself to feel how great it is.

Just imagine it: I throw Umbraco CMS installation (no sources, just the Views, css, js, bin, etc.) into vs2013, run it in debug mode. Of course, I can instantly change any code and debug it in real time. Sweet. But I also have Browser Link enabled (with Web Essentials installed). Everything is easily configurable, and now when I edit css right from my Chrome F12, changes are instantly applied to real .css files of my solution! When I hover over some html elements in Chrome, my visual studio opens proper template/view and points me to the piece of code that produces this output!

And all this magic works not in some laboratory perfect settings of default asp.net project. It is working in installation of a CMS! I’m totally amazed, excited and happy right now :)

 

Visual Studio 2013 Browser LinkVisual Studio 2013 Browser Link Dashboard showing currently connected browsers, and default Umbraco CMS 7 + uBlogsy 4 showing off F12 interface of Browser Link

 

If you haven’t tried vs2013, you must give it a try.
Only this feature is enough. But developers and managers presenting new Visual Studio 2013 wasn’t even giving Browser Link that much attention. For example, they were usually emphasizing Peek Definition more.

For the moment, my vs2013 + ReSharper 8 setup doesn’t even lag on my top-end PC (like vs2010 + ReSharper 6-7 used to), and they have added colors back to VS UI! What else can we want, right? :)