Better HN
topnewbestaskshowjobs
Log inSign up

staticassertion

13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions

@insanitybit
Submissions

comment 4y ago · link · parent

I think I would really enjoy reading you explain what's obviously wrong about that.

comment 4y ago · link · parent

I just think people seriously overestimate the cost of a mutex when implemented efficiently. Unlocking a mutex can be ~10-20x faster than fetching a value from main memory, or just a bit slower than a few integer operations. The way people talk about mutex operations you'd think that it's akin to hitting disk when it's actually a few orders of magnitude closer to hitting your L2 cache.

comment 4y ago · link · parent

If there's no contention there's no more synchronization compared to any other cache lines afaik.

comment 4y ago · link · parent

> you're often going to be better off eliminating the Arc/Mutex anyway

Not always. Mutexes can be really fast (10-20ns), especially since they often optimistically spin, and Arc in Rust is (often) relatively low cost since you can hand out "free" refs without touching the atomic.

If removing the Arc/Mutex would require allocations the Arc/Mutex could easily be faster.

comment 4y ago · link · parent

https://twitter.com/m_ou_se/status/1526211117651050497

These are synthetic benchmarks but it's quite significant in them.

From a different tweet:

> It's the total time for 32 threads each doing 10'000 lock+unlocks (on a 64C/128T threadripper). So, the numbers you quoted correspond to a lock+unlock operation going from 8.75ns to 2.45ns, under low contention.

> The numbers can vary a lot in different situations/hardware though.

comment 4y ago · link · parent

> I would need you to explain what your bar is for decentralization, and why it's so high.

A single entity being capable of significant or total disruption of the network.

> As for privacy, the technology has come a long way in the last decade due to the development of Zero-Knowlege Proofs. I can share a few links if you are interested.

I am interested. I'm aware of some progress being made here theoretically, but I have not seen implementations (I do not follow closely at this point).

comment 4y ago · link · parent

Who are these people who are well educated and live in first world countries, competent enough to do these tasks, but also are in a position to benefit from crypto? To me the only (incidental, not at all fundamental) benefit of crypto is if you live in a country with sanctions and you need to get money in/out.

> Centralized systems work great... until they don't.

There has yet to be a decentralized cryptocurrency. We can't even say things like "decentralized systems work great until they don't" because so far they don't exist, and what does has been less than "great".

> Our grandchildren will wonder why we allowed the free world to export the means of surveillance to the third world.

I don't even know what you're going for here? Crypto solves surveillance now? The global, distributed ledger that everyone can fundamentally access because that's the whole point?

comment 4y ago · link · parent

That is what the first sentence of the article is about and it is the premise of the entire article?

comment 4y ago · link · parent

Why is that unlikely to be the case?

comment 4y ago · link · parent

The first three paragraphs you wrote are all very easily shown to be irrelevant. Again, the very first sentence of the post shows that the cache is designed to improve latency.

And as the article points out, the cache is in fact lower latency and does improve latency for a single request. The issue is with throttling.

The article is absolutely not suggesting disabling caching, nor does any information in the article indicate that that would be a good idea. Even with the issue pointed out by the article the cache is still lower latency for the majority of requests.

comment 4y ago · link · parent

Moving to a continuous, asynchronous strategy versus a point-in-time synchronous strategy, seems like a perfectly reasonable way to improve performance.

comment 4y ago · link · parent

My guess is that inotify is so slow with large directories that it wasn't worth it. Plus inotify has cumbersome user limits.

inotify has a number of other relevant limitations, like not being able to create recursive notifications or handle "move" operations. Implementation effort is going to be way higher for an inotify-based system, and of course that's made far worse by the numerous file systems in linux - I imagine any implementation would probably start first with ext4.

I suspect an ideal solution would be via ebpf, but I'm not sure.

comment 4y ago · link · parent

OK but that's got nothing to do with the post.

comment 4y ago · link · parent

One of the main claimed benefits is that this is easily reversible, if it goes badly.

comment 4y ago · link · parent

There's probably some balance here. Since there's a limit of 9 concurrent requests before throttling occurs you can bucket 9 objects, concatenating into each. So if you have a bunch of static content, concat that into 1 bucket. If you have another object that changes a lot, keep that separate. If you have two other objects that change together, bucket those, etc.

Seems like a huge pain to think about tbh. Seems like part of the problem would be solved by compiling everything into a single file that supported streaming execution.

comment 4y ago · link · parent

I find it odd to call it a bait and switch when the first thing in the article is an outline.

> It is about "network" vs "the (usually antiquated) file-backed database your browser calls a cache."

It's actually nothing to do with the design of the cache itself as far as I can tell. If you finish reading the article you'll see that it's about a throttling behavior that interacts poorly with the common optimization advice for HTTP 1.1+, exposed by caching.

> The latter is kind of self-evident: the browser cache is there to save bandwidth, not to be faster.

I don't think that's something you can just state definitively. I suspect most people do in fact view the cache as an optimization for latency. Especially since right at the start of the article, the first sentence, the "race the cache" optimization is introduced - an optimization that is clearly for latency and not bandwidth purposes.

comment 4y ago · link · parent

That doesn't sound right based on my reading of this document. If I'm wrong please do correct me, I don't know a ton about the internals here.

https://docs.google.com/document/d/1Aa7OKFRdtmn4IFzgHYfqeqk5...

comment 4y ago · link · parent

I imagine it's just that the cache is in an awkward place where the throttling logic is unaware of the cache and the cache is not able to preempt the throttling logic.

comment 4y ago · link · parent

The Y axis of the chart that I linked, entitled 'Cache Retrieval Time by Count of Cached Assets', shows latency well above 100ms.

comment 4y ago · link · parent

> Has anyone else observed this and have an explanation?

Yes that is the subject of this post.

https://simonhearne.com/2020/network-faster-than-cache/#the-...

comment 4y ago · link · parent

Since apparently no one is willing to read this excellent article, which even comes with fun sliders and charts...

> It turns out that Chrome actively throttles requests, including those to cached resources, to reduce I/O contention. This generally improves performance, but will mean that pages with a large number of cached resources will see a slower retrieval time for each resource.

comment 4y ago · link · parent

The issue has nothing to do with the cache itself. It's about the throttling behavior.

comment 4y ago · link · parent

The issue has nothing to do with disk speed. If you had read the article you'd see a very nice chart that shows the vast majority of cache hits returning in under 2 or 3ms.

comment 4y ago · link · parent

Not really. The issue is with throttling.

comment 4y ago · link · parent

So then the exchanges would be the regulators? Also now you have a nice public ledger of what porn everyone is buying lol

comment 4y ago · link · parent

As far as I know there is nothing illegal about drawn furry pornography and no requirement on the part of Visa/Mastercard to restrict access to that content. We even saw Mastercard reverse their decision on OnlyFans recently due to major backlash, so they obviously have the power to do so.

comment 4y ago · link · parent

There's a lot of "mainstream" porn but if you're a furry or have niche interests I imagine you're dealing with a much more limited content market.

comment 4y ago · link · parent

You can tell pyo3 that your type isn't Send and then it'll panic if the object is accessed from multiple threads. Given that that's the only safe option, that seems fine? You say that that's not acceptable for a production library but I don't see the issue.

You have the same restrictions in C++ except with worse consequences.

1
394041
164