HackerTrans
TopNewTrendsCommentsPastAskShowJobs

CompuIves

no profile record

Submissions

Show HN: CodeSandbox SDK – Sandboxes for AI Agents

codesandbox.io
3 points·by CompuIves·2 anni fa·1 comments

Etched Is Making the Biggest Bet in AI

etched.com
45 points·by CompuIves·2 anni fa·17 comments

We scale our microVM infrastructure using low-latency memory decompression

codesandbox.io
4 points·by CompuIves·2 anni fa·1 comments

comments

CompuIves
·27 giorni fa·discuss
Very cool to see more use of userfaultfd, really powerful API because you can fully control how and from where memory is loaded during a pagefault.
CompuIves
·3 mesi fa·discuss
This is really cool to see, reminds me of the early days of CodeSandbox. Though this API looks _fantastic_. I love that you do VM configuration using `with`.
CompuIves
·4 mesi fa·discuss
I think this is very similar! Really cool to see.

The first version we launched used the exact same approach (MAP_PRIVATE). Later on, we bypassed the file system by using shared memory and using userfaultfd because ultimately the NVMe became the bottleneck (https://codesandbox.io/blog/cloning-microvms-using-userfault... and https://codesandbox.io/blog/how-we-scale-our-microvm-infrast...).
CompuIves
·anno scorso·discuss
Yes, that's right. The Firecracker team has written a fantastic doc about this as well: https://github.com/firecracker-microvm/firecracker/blob/main....

It's important to refresh entropy immediately after clone. Still, there can be code that didn't assume it could be cloned (even though there's always been `fork`, of course). Because of this, we don't live clone across workspaces for unlisted/private sandboxes and limit the use case to dev envs where no secrets are stored.
CompuIves
·anno scorso·discuss
I talk a bit about this here: https://codesandbox.io/blog/cloning-microvms-using-userfault.... Before VM A updates its data, the data is copied over to VM B if VM B hadn't written/read that data yet.
CompuIves
·anno scorso·discuss
Oh wow! Unexpected and cool to see this post on Hacker News! Since then we have evolved our VM infra a bit, and I've written two more posts about this.

First, we started cloning VMs using userfaultfd, which allows us to bypass the disk and let children read memory directly from parent VMs [1].

And we also moved to saving memory snapshots compressed. To keep VM boots fast, we need to decompress on the fly as VMs read from the snapshot, so we chunk up snapshots in 4kb-8kb pieces that are zstd compressed [2].

Happy to answer any questions here!

[1]: https://codesandbox.io/blog/cloning-microvms-using-userfault...

[2]: https://codesandbox.io/blog/how-we-scale-our-microvm-infrast...
CompuIves
·anno scorso·discuss
It's a block for non-US IPs, I think. The page is an application form for joining them, and it only accepts US citizens.
CompuIves
·2 anni fa·discuss
A new post in what is slowly becoming a series! Happy to discuss this or answer any questions here.
CompuIves
·2 anni fa·discuss
Exactly, the result would've been different if the author would not have disabled caching.

In this case it's because the iframes are loaded/unloaded multiple times, but we also spawn web workers where the same worker is spawned multiple times (for transpiling code in multiple threads, for example). In all those cases we rely on caching so we don't have to download the same worker code more than once.
CompuIves
·3 anni fa·discuss
If you want to be efficient in Amsterdam, you take the bike or public transport. That has been faster than cars even before this change, and now more so.
CompuIves
·3 anni fa·discuss
The editor on CodeSandbox runs web VSCode, and in that version we emulate Node.js in the browser to run local extensions.