tijsvd
In postgres, connections are handled with a process fork, not a new thread. If such a fork first reads memory, even if it already exists, that causes a minor page fault, which goes back to the kernel so it can update memory mapping tables.
The operation under lock is only a few instructions, but if it takes longer than expected, then that causes lock contention. Regression in the kernel handling minor faults?
The whole thing is then made worse because it's a spinlock, causing all waiting processes to contend over the cpus which adds to kernel processing.
Mitigated by using huge pages, which dramatically reduces the number of mapping entries and faults. I reckon that it could also be mitigated in postgres by pre-faulting all shared memory early?
Try adding one year to a timestamp because you're tracking someone's birthday. Or add one week because of running a backup schedule.
Stdlib containers are all in the generics category.
The true 10x engineer looks at the project, sees the inherent needless complexity, goes back to the sponsor and uses his business knowledge to renegotiate the specs. Leading to a reduced scope with 98% of the business value and 10% of the work.
This has nothing to do with Rust. I've seen the exact same thing happening with golang in a C++ only environment. Long project, took forever, failed slowly, took a week to rewrite in C++.
Directly awaiting a future gives you more control, in a sense, as you can defer things until they're actually needed.
Second, that quote is from a time when compiler optimizations did not exist, and the programmer was supposed to use all kinds of clever tricks to speed up code (what today you get for free with -O3). That kind of optimization is the context of the quote, and it's hardly ever appropriate to just throw into some discussion about optimization.
When near 1 million users (yagni), reset sequence and do the same with 10 million (or one billion).
Doesn't solve the upside of 128-bit random numbers (ala uuid): the ability to generate remotely and expect no collision.
We use an auto-increment id, and lock inserts on the related account (which always limits the scope of the query).
The only other (stateless) way I can think of is to somehow fiddle with transaction numbers linked to commit order.
It is probably faster due to straightforward decoding, no tag switch. At the cost of not being able to reorder fields or remove in the middle.
With protobuf implementations, one always goes from schema to generated code, which means certain choices can not be handled without further markup:
- what to do with unknown enum values
- which fields become Option
- which string or bytes fields should be by-ref rather than by-value
- derive of other traits
I guess the alternative could have been to build all that into Prost, but that seemed unreasonable. I see this more as a replacement of bincode than as a replacement of Prost.
https://blog.cloudflare.com/lavarand-in-production-the-nitty...
Which answers all your questions. Tl;dr: the lava feed is only an additional entropy source, it's not like they generate keys directly from the video feed.
Or perhaps that was the original goal, to find the most significant one and the 41 bits that trail it...
Reference please? In what sense are they better, and what makes them better?
Hash tables matter more though.
Another group had already evaluated pb and found it way too slow. They had designed something similar but faster. I wrote my implementation of pb to prevent this, and showed pb could be fast enough. It was definitely the right choice at the time, as it gave us C++ speed close to the old format, plus easy interop with other languages.
> If protobuf works for Google then it essentially works for 99.999% of every other company on the globe.
Uh.. no. Google is a massive company, but if you browse the comments in this thread, you'll find multiple remarks like "this was built for Google's servers". Google have specific use cases, and they build software for that. The software may well be lacking for other use cases. I can totally imagine Blizzard wanting to write their own implementation, think of the benefits of reducing parse time in a multiplayer server.
So it's great that there are different implementations for different use cases. It helps that the wire format is simple and well-documented.
But it's somewhat ugly as well, from an architecture point of view. Because that argument translates to anything else you might want to do with these objects.
In past libraries for C++ I've tried to prevent this kind of coupling by adding generated template methods like "walk(f)" where f would be a templated callable, called with a descriptor and data reference for each field. Any kind of pretty printer or SQL statement can be built that way.
That's a bit harsh. Protobufs deliver smaller wire size than any of the newer "zero-copy" formats. And many receivers of zero-copy formats will... copy the data into some internal representation. If your protobuf implementation delivers classes that are good enough to work with internally (store in maps, forward, etc) then you don't really lose something; instead you gain, due to no manual conversion layer.
The alternative was something custom again, with better support for schema evolution, but pb was convenient due to existing implementations in Python (system tests) and C# (UI).
Take a look at an implementation like Prost, for Rust. It's very similar to what I did (10 years ago by now). Everything is just inline, except when messages can be recursive (which should be rare for most protocols).