Excellent post showing how to correctly improve code w.r.t. performance using the scientific method: hypothesis, measuring the baseline, change, measuring effect with real tools, real code. Thanks for sharing!
I also found it an interesting post in that it kind of inadvertently proves that for most situations you shouldn't optimise to this extent. Meaning, yes, the OP got impressive performance improvements but the code is also completely unreadable and utilises unsafe code sections which could expose you to security problems/memory leaks/memory corruption. Not to mention they've recreated and will need to maintain an in-h…
High-performance .NET by example: Filtering bot traffic
41–50 of 54 posts
Re: High-performance .NET by example: Filtering bot traffic
#42Earlier quoted context omitted.
No, no no no. I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. Programmers are expensive. Hardware is cheap. That doesn't justify completely throwing out the window any performance increasing changes just because a fresh college grad won't be able to understand what's going on within…
> I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. I've worked on large and old codebases for years. I've seen plenty of examples of where a "clever" programmer has optimised the heck out of a section of code, made it completely unmaintainable, and as a result forced a re-write (the…
The usual caveat of making code correct, readable and then fast in this order of course also applies :)
Re: High-performance .NET by example: Filtering bot traffic
#43Earlier quoted context omitted.
No, no no no. I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. Programmers are expensive. Hardware is cheap. That doesn't justify completely throwing out the window any performance increasing changes just because a fresh college grad won't be able to understand what's going on within…
> I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. I've worked on large and old codebases for years. I've seen plenty of examples of where a "clever" programmer has optimised the heck out of a section of code, made it completely unmaintainable, and as a result forced a re-write (the…
Re: High-performance .NET by example: Filtering bot traffic
#44Earlier quoted context omitted.
> I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. I've worked on large and old codebases for years. I've seen plenty of examples of where a "clever" programmer has optimised the heck out of a section of code, made it completely unmaintainable, and as a result forced a re-write (the…
I have worked on large codebases. You sound less like you have a solid opinion backed up by experience and more like you enjoy spouting platitudes and best practices in meetings without getting dirty with too much code yourself.
I only brought up large (old) codebases to put into context the kind of maintainability issues I am discussing, and why my perspective is what it is.
Re: High-performance .NET by example: Filtering bot traffic
#45Earlier quoted context omitted.
> I cannot believe that you are honestly saying a 2x increase to throughput in production is something you "shouldn't take seriously" because the code isn't as readable as it was before. I've worked on large and old codebases for years. I've seen plenty of examples of where a "clever" programmer has optimised the heck out of a section of code, made it completely unmaintainable, and as a result forced a re-write (the…
I have worked on large codebases. You sound less like you have a solid opinion backed up by experience and more like you enjoy spouting platitudes and best practices in meetings without getting dirty with too much code yourself.
Re: High-performance .NET by example: Filtering bot traffic
#46Blocking access based on arbitrary user agent strings is a really bad idea. Every single bad bot will avoid known user agent strings or pretend to be Google, so you're only blocking well behaved ones. Plus there's thousands of browser versions out there, so there's a very good chance you're blocking some users for no reason. The proper way to do this is to block by IP, based on behavior. Block IPs slowing down the si…
>We won’t cover black bots because it is a huge topic with sophisticated analysis and Machine learning algorithms. We will focus on the white and grey bots that identify themselves as such.
This is about not wasting time & effort showing advertising banners to good bots.
Re: High-performance .NET by example: Filtering bot traffic
#47I did something similar with nginx, the data file from 51degrees and some lua code; each instance only handles 10-20k requests/sec so no clever optimization was needed.
Would you mind posting the Lua code?
Re: High-performance .NET by example: Filtering bot traffic
#48Earlier quoted context omitted.
I have worked on large codebases. You sound less like you have a solid opinion backed up by experience and more like you enjoy spouting platitudes and best practices in meetings without getting dirty with too much code yourself.
That sounds more like a personal attack than a constructive response to the topic. I only brought up large (old) codebases to put into context the kind of maintainability issues I am discussing, and why my perspective is what it is.
Re: High-performance .NET by example: Filtering bot traffic
#49Earlier quoted context omitted.
> what if your service gets popular? Then re-design for map-reduce, and scale horizontally > What it latency for a single request can't be improved with more cores? Then look into pre-computing and caching > What if your product is used by consumers who may have old hardware? or phones, or watches, or laptops and they want their battery to last? I thought we were talking about server requests? If we are, then offload…
> But this guy is writing server software. Micro-optimizing on the server side the way he is doing is silly. Khm... What if you have millions of requests per second with tight latency requirements measured in milliseconds; and a bunch of business logic to fit into that. Such optimizations aren't so silly. There are different scenarios on both client and server sides.
Re: High-performance .NET by example: Filtering bot traffic
#50Earlier quoted context omitted.
Hardware might be cheap at some scales, but what if your service gets popular? What it latency for a single request can't be improved with more cores? What if your product is used by consumers who may have old hardware? or phones, or watches, or laptops and they want their battery to last? What if you consistently practiced at making high performance code, maybe then it wouldn't seem "unreadable" to you any more? Wha…
> what if your service gets popular? Then re-design for map-reduce, and scale horizontally > What it latency for a single request can't be improved with more cores? Then look into pre-computing and caching > What if your product is used by consumers who may have old hardware? or phones, or watches, or laptops and they want their battery to last? I thought we were talking about server requests? If we are, then offload…