Better HN
topnewbestaskshowjobs
Log inSign up

CompuIves

252 karma · joined Aug 14, 2015 (11y ago) · 95 submissions

Ives (but you can also call me Flip)

- Co-Founder Biscuit (biscuit.so) - (Previously) Co-Founder of CodeSandbox, acquired by Together

My email is first name @ biscuit.so

meet.hn/city/nl-Amsterdam

Socials: - x.com/compuives

---

Submissions

31.

Nodebox: A Node.js runtime that runs in any browser(codesandbox.io ↗)

91 points · by CompuIves · 3y ago · 30 comments

comment 3y ago · link · parent

No, we've built our own web editor & iOS code editor. In our v1 editor we did run VSCode in the browser, but that was before code-server was released (in 2018). Even if we wanted to run code-server, that would be impossible as we allow for multiple users to open the same sandbox/branch, which wouldn't fit the model of VSCode server (which is single user per server).

comment 3y ago · link · parent

Ah right, the main advantage I have here is that the dev server also stays running when I go to another branch (since it's a different VM). So I can work on one thing, share it with the team and in the meantime continue on another branch. They can see the devserver / running code, while I am working on something else.

It's especially useful for things like migrations or dependency management. In one branch I could work on something that has some database migrations, and then I can still switch to other branches without having to roll back the migrations.

I didn't know about git worktrees though! I'm going to read up on this.

comment 3y ago · link · parent

Yeah Repl.it is one of the bigger ones.

I'd say that CodeSandbox has a strong focus on extending the existing workflow for developers. That's why we have a VSCode integration, a GitHub integration with a GitHub App that creates a running dev env for every branch/PR, and we make sure that generally all editor features you expect (autocomplete, go to definition, hover info, etc) are available for the languages that we support.

comment 3y ago · link · parent

I'm using a web based IDE for my dev, but I'm biased in that sense. The main advantage for me is that I can easily switch branches, as every branch has its own VM. + I can easily share in-progress work. I do use the VSCode integration, because I'm very used to VSCode.

That said, I've also spoken with people who use a Web IDE next to their local environment. E.g. they use a Web IDE for reviewing PRs or making smaller changes, and they use their local editor for feature development.

comment 3y ago · link · parent

Yep that works, you can either create a task in the editor for it (using the CLI), or you connect it to a GitHub Repo and install actions.

That said, it is something on our radar, being able to press a button for deploy from CodeSandbox would be valuable for many people!

comment 3y ago · link · parent

Hey all! I'm one of the co-founders of CodeSandbox and a big fan of Rust. Rust support is something that we've been working on for a while, but the recent addition of Docker support in CodeSandbox really enabled it. Happy to answer any questions!

38.

Introducing Rust Support in CodeSandbox, start a Rust VM in one click(codesandbox.io ↗)

63 points · by CompuIves · 3y ago · 26 comments

comment 3y ago · link · parent

The online editor doesn't support rebinding yet, however, we have an integration with VSCode which allows you to open any branch/sandbox inside your local VSCode, with your own extensions and keybindings. That's how I've been doing most of my development with CodeSandbox!

comment 3y ago · link · parent

Yes, I should've clarified that the opinionated part is mainly in the workflow.

When you open a repo on CodeSandbox, you automatically open the main branch (e.g. https://codesandbox.io/p/github/codesandbox/test-sandbox/mai..., which is the main branch of our test repo). To contribute to this branch, you can click "Branch" in the editor, and we'll automatically create a new branch, and redirect you to the URL of this branch.

They key here is that you can share this branch (with anyone who has access to the repo). If someone else opens this same branch in CodeSandbox, they will join the same workspace as yours and see your cursor. This allows you to share in-progress work with your team more easily, because you're sharing a link to a branch. When someone else opens that link, they will see a running environment instead of static code, even if you're not online.

So you could essentially say that dev environments on CodeSandbox are multi-user, which is a key difference compared to other cloud environments. With other cloud solutions, the link is tied to your personal environment (so the link is only valid as long as you are online). With CodeSandbox, the link is tied to a branch, which can be shared and opened any time by multiple users.

comment 3y ago · link · parent

That's great to hear! We're now working a lot on making CodeSandbox a great experience for development, and we're now at the point that we're doing all our development of CodeSandbox on CodeSandbox as well. It's a quite opinionated experience, because every branch will have a URL that you can share, but it works really well when working together with a team. More info on that is here: https://projects.codesandbox.io/

comment 3y ago · link · parent

That's so great to hear, thank you!

comment 4y ago · link · parent

It might be interesting to try out the CodeSandbox app: https://apps.apple.com/nl/app/codesandbox/id1423330822?l=e.

It's the same concept, you get a VM you can work on from a native app, but our app is for iOS only and supports iPads natively.

Disclaimer: I'm one of the co-founders of CodeSandbox.

comment 4y ago · link · parent

Thank you for creating this! I remember using this for the header of my portfolio website before I got my first job. Happy to see that it's still active, I hope that the monetization model is working out well!

comment 4y ago · link · parent

That would work! You could even run the Postgres inside the VM, and the data inside the DB will be cloned as well between clones.

comment 4y ago · link · parent

Yep, that's exactly it. So the moment the fork happens, we create both a new layer for VM A and VM B, so they can both use the same base layer.

comment 4y ago · link · parent

That is very interesting, would it also be able to handle paused VMs where it buffers the packets up to certain threshold?

comment 4y ago · link · parent

Thanks a lot, I appreciate that!

comment 4y ago · link · parent

Right, that makes sense. Once the memory page is in memory it should be fast though. We use shared mapping right now, and practically the pages stay in memory during the lifetime of a VM once they've been loaded, but we need to do more testing when there's more memory pressure.

I've been looking at huge pages recently, I'm going to do some more testing with transparent huge pages today and see if it changes performance. Unfortunately we cannot use reserved huge pages because that doesn't work with shared mmap on say an XFS FS.

Another idea is to make clones use the same memory base layer of their parent, then the pages are already prefaulted and it would deduplicate overall memory usage. Many things to discover still..

comment 4y ago · link · parent

You're completely right. Right now we're hosting the VMs on bare-metal at Hetzner, and we're looking at OVH or Contabo for hosting in the US.

comment 4y ago · link · parent

So let's say VM A is already running, and it's cloned to VM B. When that happens, we freeze the memory of VM A, and link it to VM B. For both VM A and VM B, any new write will be done to a new layer.

comment 4y ago · link · parent

The TCP connection gets "paused", it doesn't get broken but packets don't arrive. The packets that don't arrive are seen as packet loss, and so they get resent. If the connection stays frozen too long it will lead to disconnection (at least of the websocket connection to the VM).

For IP uniqueness, we give every VM the same IP, but we put every VM in its own network namespace. Then we have iptable rules to rewrite the src/dest IP on every packet that enters the network namespace.

comment 4y ago · link · parent

Yes, and this is also the biggest challenge. Right now we use XFS to enable CoW, but that quickly leads to filesystem fragmentation. I'm still looking at a way that we can quickly let both VM A and VM B use the same base snapshot, and write new changes to either anonymous memory or a file.

comment 4y ago · link · parent

This is something I will look into! I'm thinking it could reduce start time because we have to copy the mem snap from disk to tmpfs, essentially loading it into memory, but I'm going to try this!

comment 4y ago · link · parent

Yes! We're watching cloud-hypervisor as well, it might also be more suitable for our use cases.

Yes, we did look at live migrations since there's a lot written about it and it's the closest to cloning a running VM. Lots of development in that space!

comment 4y ago · link · parent

Exactly! We're looking at the second use case, to have a VM running tied to the git history. Right now we do this on a branch level, so you could say "connect to branch X on microservice Y" from another microservice, and you can test APIs quickly. There's a lot of new things this enables!

comment 4y ago · link · parent

Yes it's a good point, this is one of the reasons that we wanted the fork time to be low. If we keep it low enough, the connection won't break and other users won't notice it. That said, for some things (like terminal access) it's impossible to hide it.

Practically, 99% of the forks will be done from the `main`/`master` branch of the repo, which is read-only for everyone on the team. So the mini-pause isn't breaking in those cases.

comment 4y ago · link · parent

I'm very eager to see more developments in the fresh start times!

The main reason why snapshotting became interesting for us, is because we're running development servers defined by our users. A development server could take a long time to start, sometimes minutes.

So even if we can start the VM fast, the most important speedup for us is on the user code that we cannot control.

comment 4y ago · link · parent

Could you share why you're seeing such a slowdown? I've mainly experienced a slowdown when loading pages for the first time, since new pages need to be page faulted into memory from disk first, but after those pages have been loaded into memory I don't experience any slowdown compared to fresh starts. That said, that's only based on how I've experienced it with the type of workloads that we run on the VMs.

comment 4y ago · link · parent

I don't believe Firecracker currently supports GPU (latest what I saw about it is here: https://github.com/firecracker-microvm/firecracker/issues/11...). But I wouldn't be surprised if there's another MicroVM manager that would support GPU + snapshotting.
1234