Testing, Testing, Testing (and some goodies for developers)
Holochain Dev Pulse 89
The big focus of the last couple weeks has been testing Holochain, by way of testing Elemental Chat on HoloPorts. We’ve narrowed down the scenarios where performance decreases, and we’re doubling down on making Holochain work well in those scenarios.
I’ve also got a grab bag of news for developers — tools, promises of tools, and breaking changes in Holochain that should make your life a bit easier.
- Testing Holochain, Holo hosting, and Elemental Chat: the work continues
- HoloFuel screenshots and overall progress update
- Breaking changes in Holochain — easier serialisation, new app install method
- holochain.love is back!
- Build It! episode 5: a version control hApp, for hApps
- Reminder: FOSDEM coming up, see you there
Testing Holochain, Holo hosting, and Elemental Chat: the work continues
At the end of last year, we were busy testing Holochain on HoloPorts using a basic chat app called Elemental Chat. In terms of proving that Holochain does what it’s supposed to, testing was wonderfully successful and confirmed that all the refactoring work was worth it.
In terms of performance, we saw mixed results — while local operations were much faster than they had been in the previous version, networked operations saw a slow performance hit over time. It would start out fast — as fast as you’d expect a cloud-based chat app to be — and degrade as more messages were published. Signals (fast but unreliable) would drop, and DHT entries (slow but reliable) would take a long time to propagate. What’s crucial is that the DHT was doing a great job of maintaining resilience in the face of congestion. But we weren’t satisfied with the performance.
This month we’ve been digging deep into the stack, looking for culprits. The ever-helpful pre-release testers have been working with core team members to identify what scenarios suffered the most. This has been complemented by automated tests that attempt to mimic real-world usage with up to 500 users. So far we’ve determined that the slowdowns seem to come most often with a large number of agents communicating all the time.
Our goal right now is simply to identify some ‘low-hanging fruit’ — small optimisations that will take us to the place where we feel good about releasing Elemental Chat to everyone’s HoloPorts. It won’t represent the end goal of fast, resilient P2P apps ready for the real world. The real work — sharding the DHT, deep-optimising the gossip, improving database performance, and more — will come later when the time is right in our development cycle.
One interesting note about the automated testing: we’re doing it on real HoloPorts in an isolated network that’s identical to the real HoloPort network. You might remember the TryCP server — it was a backend component that allowed devs to orchestrate the running of Tryorama tests across multiple devices. We used it heavily in our early HoloFuel tests to look for bottlenecks and failure points. The dev team has updated TryCP to work with Holochain RSM, and each of the HoloPorts involved in the automated tests has it installed. That means that we can write test scripts that exercise multiple HoloPorts in various configurations to get a feel of how everything will work in real life.
We’ve been thinking about offering this as a ‘Tryorama-as-a-service’ tool in the future. Instead of having to spin up a bunch of cloud instances to test their hApps, developers would be able to enlist real HoloPorts to do the testing for them. If you’re going to pay someone for automated testing, it may as well be the actual machines who will be running your apps in the future. Stay tuned for more thoughts on this!
HoloFuel screenshots and overall progress update
Nearly everybody loves screenshots, and we’ve got a bunch of lovely ones for you! Mary’s most recent Holo Today article gives you glimpses of the upcoming rebirth of the HoloFuel UI.
A bit of background: HoloFuel is more than a wallet app. It’s the algorithms that underlie all the hosting credit transactions in the Holo hosting network. The Publisher Portal, Host Console, and reserve account controller will all use it behind the scenes.
But we also want to make a user-friendly wallet app for people to send each other HoloFuel as if it were a traditional cryptocurrency. If you take a look at our newly updated roadmap, you’ll see that we’ve moved this ahead and will be releasing it sooner than expected.
In the meantime we’ve been working on all the back-office infrastructure to power the reserve account, including the reserve account controller, the Ethereum wallet that coordinates redemption of HoloTokens for HoloFuel and back, and the KYC integration.
Mary’s article also gives a broad overview of where we’re at with Holo hosting today and what pieces we’re tackling next. It’s a good — and encouraging — read!
Breaking changes in Holochain — easier serialisation, new app install method
Holochain RSM still doesn’t have official release numbers, and in the meantime we’re pushing its development forward in response to feedback from hApp devs. Here are a few recent changes:
Easier serialisation across the WASM boundary
Previously, everything that went into and out of the DNA had to implement the `SerializedBytes` trait. We’ve done away with that requirement, and now your functions can accept and return anything that Serde can automatically serialise! That means bare tuples and other primitives don’t need to be wrapped or newtyped, and more complex structs and enums are also simpler — you just have to make sure they implement Serde’s `serialize` and `deserialize` traits.
There’s a lot more to this change, including new entry and result types; you can read about it in this pull request.
New app install method: register DNA first, then activate
Previously when you instantiated a cell, you would do it in one step: `InstallApp` would take a path to a DNA payload, optionally mix it with a new UUID or properties to ‘fork’ it into a new DNA, connect it to an agent ID, and boot the thing up with the agent’s provided joining proof.
You can now also pre-register a DNA with `RegisterDna`, optionally passing in UUID or properties as before, and later instantiate as many copies as you like by passing the registered DNA’s hash to `InstallApp`. Passing a DNA file path to `InstallApp` is deprecated in favour of this new method.
You can now also pass a DNA file’s raw bytes to `InstallApp` and `RegisterDna` rather than a file path if that works better for your use case.
There are a couple small breaking changes to the `InstallApp` endpoint to accommodate passing DNAs as already-registered hashes or raw bytes. There’s also a hidden breaking change; you’ll have to rebuild your DNAs (but you don’t need to recompile the WASM binaries) before you use them in the newest Holochain.
holochain.love is back!
For a while we haven’t had an easy way to get started with the Holochain dev tools like we did with Holochain Redux. Now you can use the good old one-liner to get Holonix, our dev tools distribution, running with Holochain RSM:
For those of you who want to get working both easily and quickly, you can use our binary cache to avoid all the time spent watching Holochain compile. If you’re on Linux, try this one-liner:
$(nix-build https://nightly.holochain.love — no-link -A pkgs.holonix)/bin/holonix
You’ll find it’s much faster than before, and you can enter the nix-shell even when you’re offline using this command:
The only difference with this new method is that it doesn’t automatically keep up to date with the most recent Holochain; you can just run the big long command again to update.
Build It! episode 5: a version control hApp, for hApps
In this episode Philip takes David on a tour through the source code management tool he’s built for hApps, which itself is a hApp. It currently supports commits, branches, and merges, along with a visual tree viewer in the Holochain Builder IDE (formerly CRISPR). As Philip explains, Git is just a distributed, hashchain-based revision tracking tool, which sounds an awful lot like what Holochain is too.
(Note: we had intended for this to be a live-streamed episode, but Zoom-related glitches thwarted those plans. Join us live for Build It! #6 on the 9th of February or go ahead and share your question early!)
Reminder: FOSDEM coming up; see you there
This is just a reminder to put the FOSDEM 2021 online conference, 6–7 February, into your calendar. We’re co-hosting the decentralised web track with other DWeb folks, and there should be a lot of people from the Holochain ecosystem there. I find these sorts of events are great, not just for learning about Holochain, but for the connections we make with other people. I see a lot of projects — Secure Scuttlebut, Dat/Hypercore, IPFS, GUNdb, Fluence, and others — as allies with slightly-different-but-mostly-similar approaches to the same problems of centralisation. You’re sure to meet lots of kindred spirits and I hope some of them become your future friends and collaborators!