Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom firmware performance monitoring #12

Open
Yangyuanxin opened this issue Jan 1, 2025 · 4 comments
Open

Custom firmware performance monitoring #12

Yangyuanxin opened this issue Jan 1, 2025 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority_medium Medium priority item

Comments

@Yangyuanxin
Copy link

I don't think porting Klipper's original ecosystem to this platform is a good choice, as Python usually runs much slower Can you guarantee that all of this, as you have done, will not cause Timer too close issues during the printing process?

@jbatonnet
Copy link
Owner

Hi @Yangyuanxin, thank you for your message.
If I get things right, you're an embedded dev at Anycubic. Good job for the Kobra 3! It's so cool to see you interact with the community!

I agree that porting the full ecosystem would not be a good idea in terms of performance. My goal with this custom firmware, is not to add many features, but more to open the gate to existing tools and ecosystem. I do not intend on running many modules or even original Klipper, but to leverage the go klipper ecosystem instead to provide a seamless experience while keeping the original experience.
That's why, for example, I added a proxy to interecept print calls and redirect them to gkapi instead.

Now that's a very interesting topic you open here. Here are some of the features I added:

  • mjpg-streamer: This one replaces gkcam completely. I tried to match what is already happening in Anycubic Slicer with 480p video for example.
  • Moonraker: This is the big one. I did not measure performance here, since prints are handled by gkapi/gklib, the only real impact is the monitoring of printer state and streaming to third party clients. That would be interesting to measure
  • Mainsail/Fluidd: nginx doesn't impact things that much from what I've seen. Memory usage is low, the apps are PWA, only active calls are using very little CPU
  • moonraker-proxy: This one has only memory impacts and redirects print calls, should be fine
  • SSH/ADB: Memory impact only
  • OctoApp companion (coming): Same as Moonraker, memory impact and streaming some events.

So IMHO the main bottleneck here could be memory. I need to monitor that closely and get real numbers.
Now I know the target platform is pretty limited in terms of performance. I believe there's some headroom, maybe not much.

From my personal experience with the firmware and the tests I've done, everything seems to work properly, but me and the community will need to keep a close eye, and we'll find solutions if needed!

Again, my goal is not to replace the go klipper environment but rather to expand it and connect it to the rest instead. I don't want to add all the features and plugins or whatever (people can look for other firmware or solutions if they want), I just want to create a cool experience using my Kobra 3!
And Anycubic services are still usable, but you can print from your favorite Slicer, monitor from the web, use a VPN to access my printer locally and privately as I'm doing.

So TL;DR: no guarantee, but I feel that everything is working well now, and I'll work on solutions if something seems to be slowing down!

I'll keep this thread open to follow performance impacts. And if you are experiencing performance impacts right now, give me more information, I'll try to add more SWU tools to help people monitor that and share their experience.

@jbatonnet jbatonnet added documentation Improvements or additions to documentation enhancement New feature or request priority_medium Medium priority item labels Jan 1, 2025
@jbatonnet jbatonnet changed the title Performance issues arising from custom firmware Custom firmware performance monitoring Jan 1, 2025
@Yangyuanxin
Copy link
Author

It's an honor to discuss this topic with you, and I'm happy and open to your suggestions for improving the firmware and selecting some good ideas to gradually optimize and import into future firmware versions. Regarding the new features you added above, I think the main goal you described is to have a similar interaction and experience as the original. I think this is a good idea, but it may need more work to support it due to performance requirements. We're very happy to build a good relationship with the community!

@ducati1198
Copy link

It's an honor to discuss this topic with you, and I'm happy and open to your suggestions for improving the firmware and selecting some good ideas to gradually optimize and import into future firmware versions. Regarding the new features you added above, I think the main goal you described is to have a similar interaction and experience as the original. I think this is a good idea, but it may need more work to support it due to performance requirements. We're very happy to build a good relationship with the community!

Hello there. The community will love for more of a open source of the factory firmware. It’s will help the community to integrate more vanilla klipper to kobra 3. I personally own a creality k1 max and the community of k1 max is up to date with all the root and mods because creality release a full open source firmware. With thatvsaid thanks for all you guys work to improve

@jbatonnet jbatonnet pinned this issue Jan 4, 2025
@jbatonnet
Copy link
Owner

jbatonnet commented Jan 13, 2025

I made a quick go app to collect and expose system metrics to Home Assistant using MQTT.
I intend on adding this monitoring service in the firmware in future releases to easily track performance related issues.
For now with this basic test, it seems okay, but I will leave it running long-term on my printer to see what's happening.

Here is the data of a small prints with the latest version of Rinkhals installed and enabled. I had Mainsail open on the side to create some traffic.

image

On top of that, I develop a small "apps" system, that allows users to easily enable or disable apps / services using the touch screen.
In next versions, I will most likely add a "memory usage" screen to show the user how much memory they have left to safely use, like in video games with VRAM usage.

I feel like it could be a solution for the long term to add features, disable them by default and allow users to pick and choose what they want based on their situation / memory availability.
CPU doesn't seem to be an issue for now, but I'm including the same principles for CPU as well for later.

Example apps for now: https://github.com/jbatonnet/Rinkhals.apps

rinkhals-ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority_medium Medium priority item
Projects
None yet
Development

No branches or pull requests

3 participants