Best Practices for Optimizing Canister Performance on the Internet Computer

Hi everyone,

I’ve recently started developing on the Internet Computer and I’m really impressed by the architecture and capabilities of the platform. However, as I scale my application, I want to ensure that my canisters are optimized for performance and cost efficiency.

I have a few questions and would love to hear from the community:

  1. What are the key strategies to minimize cycles consumption?
  2. Are there any recommended tools or libraries for monitoring canister performance in real time?
  3. How do you approach data storage optimization, especially when working with large datasets?

Thanks!

Respected community members!

Hello and welcome!

There are a lot big-brained people on here who will no doubt steer you in the right direction. Some quick points from my experience

  1. Working in runtime memory (not stable) is the cheapest and quickest way to store data. It is however limited to (IIRC) 4gb at the moment. It’s also super easy in Rust with standard structures working out of the box.

  2. There are two main stable memory Rust crates you can use on the IC

  • IC Stable Structures - This was created by Dfinity and I believe is the most widely used. It is however not as performant in terms of instructions as;
  • IC Stable Memory - This was crated by a big-brain member of the community. I’m not sure if it’s still being maintained but is what I generally use. It’s maybe not quite as easy to use though.

Having said all that - I recently hit a problem with one of my canisters (post here) due to memory limits. It could be worth keeping an eye on that post to see what the giga-brains say about it.

Cheers!

2 Likes