HNHacker News
TopNewBestAskShowJobs

karl_p

5 karma · joined December 13, 2021

submissionscomments
karl_p··on The Software Engineers Paid to Fix Vibe Coded Messes
As the mythical man month says: never ship the prototype. Plan to write one and then throw it away.
karl_p··on Ask HN: Who wants to be hired? (June 2025)
Location: Chicago, IL

Remote: Yes

Willing to relocate: No

Technologies: C#, AWS, CDK, Postgres, DynamoDB, Snowflake

Résumé/CV: https://karl-pickett.dev/resume

Email: On resume

25 years of uncompressible experience. I will fix your thorniest backend, API, and distributed systems problems using C#, C++, or Rust (and the KISS principle)

karl_p··on Just make it scale: An Aurora DSQL story
The JVM can relocate memory to avoid fragmentation. Rust can't, at least natively. Are they not worried about this regression?
karl_p··on AWS Lambda Is Not a Magic Reliability Wand
https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-...

> Your function code is cleaner, simpler, and easier to maintain.

I don't think your post covers the nuances. "Not a correct implementation"? We weren't trying for lowest latency, we were trying for highest reliability / simplest code / easiest to test. How do you test that your reused connections handle the "timed out right as next request comes in" case?

karl_p··on Python Developer Survey 2018 Results
Hmm, I spent >10 years with Python and on large/important apps it's hard to refactor and slow. (PS they're still using Python 2 as well). I want to pivot to C# on Linux / .Net Core.
karl_p··on Benchmarking 1M C# tasks vs. Go goroutines
Hi, author here. Thanks for the kind words!

I ported the static site generator for patternedpom.com (sells handmade cards) from Python to C# without changing any layout or styling (PS I don't claim to be a frontend person). It was a code port only. 1000 LOC of C#, and it took me two weeks.

I am happy with the result code - The classes are immutable (auto properties / read only collections)[1], LINQ is a very suitable replacement for list comprehensions, and it's faster than the python.

Razor Templates are very nice - I have an outer layout file and an inner template for each page. I think they came out very cleanly, and I can do LINQ inside of them[2]. Obviously you can do similar things with jinja templates, but razor templates won't compile if something is wrong / doesn't match what the model exposes (yay for catching bugs early). And you can still pass a "dynamic" type object if you want python like behavior (that throws an exception on unknown property).

The "backend" is a google spreadsheet (using their .NET SDK) and some CommonMark markdown files. So it's not doing anything dynamic (yet, I'm almost done adding digital purchases using AWS Lambda / PayPal IPN, which would be a new feature for the site). And it syncs using AWS's S3 .NET SDK.

I don't think it was actually that many more lines of C# compared to python, in any case it's worth it for me. I am tired of using scripting languages for things other than, well, scripts. I hope Microsoft doesn't break things on me in a few years (fingers crossed).

That said... let's look at some other issues.

- vscode is ok. not perfect, probably some bugs (I get "file not found" popups from time to time that I have to close), but it's free. At least if you have the time to learn it. (I'm overwhelmed by all the configuration options really... and I'm trying to use the vim plugin which probably isn't helping my cognitive load)

- minor things: no generic ordereddictionary (casting isn't horrible though), no inplace collection sort() that takes a simple Key lambda, like the LINQ OrderBy() that copies.

- Library ecosystem - this is probably the #1 thing to check out. Does a good library exist, and does it run on .net core. Compared to Java or python, it's probably less, but do your own DD in advance. There is not even a standard command line option parser in .NET Core - so if it's anything you need outside of the core language, you need to build/buy/find it. It doesn't try to be a "batteries included" thing.

- Another example with libraries: I was looking at adding dynamic search with AWS lambda, but the .net lucene library seems to be an old port of the java library.

1. https://github.com/kjpgit/ppom/blob/master/source/SiteBuilde...

2. https://github.com/kjpgit/ppom/blob/master/source/SiteBuilde...

karl_p··on Instacart paying 80 cents an hour because worker received a large tip
My wife looked into instacart and we canceled after learning they don't provide business car insurance for their drivers. What a scam.
karl_p··on Memory usage of a toy C# server and client with 500K concurrent connections on
Yeah, I should clarify what I was saying. I wasn't calling Task.Run(), but I was doing:

    for (var i = 0; i < 1000000; i++) { 
        var unused_task_var = RunTaskAsync();
    }
    await RunMainMonitoringTaskAsync();
And I purposefully wasn't calling await on "unused_task_var". And this was doing what I wanted, running all those tasks on multiple background threads in the pool, as long as RunTaskAsync method itself yielded once early on in its function (to return control back to the for loop).

tl;dr If you call an async method and don't await on it, it will be parallelized - for a console app, at least.

Honestly, I don't find the MS docs on this to be that great. Not 100% sure I'm even doing it the right way here. Everybody says use Task.Run but that is for CPU bound tasks. I want to run a ton of IO waiting tasks.

edit: looks like I'm doing it right. See "Async Composition" @ https://blog.stephencleary.com/2012/02/async-and-await.html

karl_p··on Memory usage of a toy C# server and client with 500K concurrent connections on
That is a good post and a valid criticism.

I'd say the more important concern with c# is to be careful you're not accidentally calling a "really blocking" function from an async method, or you will lose scalability. The lesser issue is the mundane task of changing all your function signatures in the chain to async.

I too would use Go if it didn't regress in every single area for me, other than concurrency, and make me sad.

karl_p··on Memory usage of a toy C# server and client with 500K concurrent connections on
That is what I thought until I wrote the benchmark(s) in the post. I was surprised that even though I never called Task.Run, things were being run on 4-10 background threads.

It does use a threadpool scheduler by default for a console app. Yes, I could override that if I wanted to.

karl_p··on Websocketd
They have specified the lambda runtime. https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.ht...

Basically: your instance POSTS to an endpoint to get/reply to requests, one at a time.

I can't wait until you can specify that a lambda instance can handle a certain # of requests in parallel. Ex: things just blocked on IO/DB. That would make better use of your RAM.

karl_p··on Memory usage of a toy C# server and client with 500K concurrent connections on
Correct, hard to use TCP for 500K connections for a quick test when there are only 64K source ports which suffer from TIME_WAIT issues as bonus. It uses Unix Stream sockets.
karl_p··on Memory usage of a toy C# server and client with 500K concurrent connections on
It still will be amortized by your application's data. For example, reading and buffering actual messages. The benchmark literally just has a one byte "buffer" per connection.

I threw this benchmark together in a couple of hours pretty easily. The most annoying part was just measuring the RAM :-)

But yes, everything is a tradeoff. If you want safety, you pay more - either in RAM, or in cognitive load.

karl_p··on I measured the overhead of a single C# async task (coroutine): ~250 bytes
Ugh, I later realized I'm off by a factor of 4 because statm shows values in 4K pages, not 1K units.