Workspaces: Feeback #2747
jbauer opened 2 months ago

I tried the workspaces feature and noticed some things:

  • I dont use EE but could still use the "codex in container" template (the container switch is active even though it says it requires EE)
  • I was cloning a large repo and some clone progress might be usefull to print in the workspace logs.
  • The console is extremely slow. Between 700ms - 1s for each key stroke to be recognized. Wondering why? I am also exploring a local deployment of coder.com for web based workspaces for AI agents. It uses Terraform to build a workspace container and gives you a web terminal but keystrokes are nearly instant. Both OneDev and Coder are behind a SSL terminating NGINX proxy with the same general proxy configuration.
  • Even though I haven't changed anything in the workspace the Changes tab in OneDev did not load the first time and then load very slowly afterwards. I also tried workspace with a small project and Changes tab took 4s to load without changes.
  • Robin Shen commented 2 months ago

    Thanks for your feedback.

    I dont use EE but could still use the "codex in container" template (the container switch is active even though it says it requires EE)

    This feature is intended to be in CE. Removed EE notice.

    I was cloning a large repo and some clone progress might be usefull to print in the workspace logs

    Clone progress now displayed

    The console is extremely slow. Between 700ms - 1s for each key stroke to be recognized. Wondering why? I am also exploring a local deployment of coder.com for web based workspaces for AI agents. It uses Terraform to build a workspace container and gives you a web terminal but keystrokes are nearly instant. Both OneDev and Coder are behind a SSL terminating NGINX proxy with the same general proxy configuration.

    Tried different combinations but can not get this reproduced. Running locally with Nginx frontend and SSL is instant. This instance is behind Cloudflare and nginx, and the remote terminal typing speed is also acceptable.

    Even though I haven't changed anything in the workspace the Changes tab in OneDev did not load the first time and then load very slowly afterwards. I also tried workspace with a small project and Changes tab took 4s to load without changes.

    Changes page is a lot faster now.

  • jbauer commented 2 months ago

    The console is extremely slow. Between 700ms - 1s for each key stroke to be recognized. Wondering why? I am also exploring a local deployment of coder.com for web based workspaces for AI agents. It uses Terraform to build a workspace container and gives you a web terminal but keystrokes are nearly instant. Both OneDev and Coder are behind a SSL terminating NGINX proxy with the same general proxy configuration.

    Tried different combinations but can not get this reproduced. Running locally with Nginx frontend and SSL is instant. This instance is behind Cloudflare and nginx, and the remote terminal typing speed is also acceptable.

    That is strange but I already thought that it is likely fast for you because you wouldn't have released it otherwise. It is barely usable for me. Can you outline how the web terminal is implemented and how keystrokes are transmitted so I have some pointers for investigation? Given that it works very well for my Coder deployment there must be something off with OneDev configuration/deployment. I think Coder uses xterm.js + websocket connection for its web terminal.

    I also have an additional feedback point:

    The docs note that one can use a custom image for workspaces but it doesn't say if that image must meet any requirements. Does OneDev need some specific packages to be installed, eg. tmux, screen or similar, so it works without issues? For example in my case I have a base image for development purposes with self-signed CA certificate trusted by linux and java and I would like to extend from that image instead of yours.

  • jbauer commented 2 months ago

    The console is extremely slow. Between 700ms - 1s for each key stroke to be recognized. Wondering why? I am also exploring a local deployment of coder.com for web based workspaces for AI agents. It uses Terraform to build a workspace container and gives you a web terminal but keystrokes are nearly instant. Both OneDev and Coder are behind a SSL terminating NGINX proxy with the same general proxy configuration.

    Tried different combinations but can not get this reproduced. Running locally with Nginx frontend and SSL is instant. This instance is behind Cloudflare and nginx, and the remote terminal typing speed is also acceptable.

    I think I found a reason why the web terminal is slow.

    I do know that the permission checks are relatively slow in OneDev for my normal user account (manager for the root project = every project) and any click in the OneDev UI has a noticable delay of 500-800ms. The installation has about 60-70 repositories arranged as a project tree in the form <single organization>/<project-types>/<projects>. I did a quick look at the network traffic when the web terminal is created and I can see a websocket connection to OneDev instead of the workspace container. Every keystroke seems to be routed through OneDev.

    So I logged out and then logged in as administrator account (the first account you create when installing OneDev). For this account I think permission checks are skipped because the OneDev UI is generally significantly faster as admin. Well and the web terminal of a workspace is very fast as well as admin.

    The culprit seems to be slow permission checks for every keystroke. In general I would love to see faster checks for whole OneDev UI so it does not feel sluggish as normal user but at least for the web terminal the delay makes it completely unusable.

  • yjshen removed comment 2 months ago
  • Robin Shen commented 2 months ago

    Permission check of normal user should not be so slow. Normal user on this instance is not noticeably slower than admin. Can you create an example installation demonstrating the issue and attach the whole OneDev installation directory here?

  • Robin Shen commented 2 months ago

    Meanwhile, will optimize to avoid permission check against each keystroke.

  • jbauer commented 2 months ago

    Permission check of normal user should not be so slow. Normal user on this instance is not noticeably slower than admin. Can you create an example installation demonstrating the issue and attach the whole OneDev installation directory here?

    Not immediately. On this installation here you have 200+ projects but no real hierarchies. I have 67 projects all in a hierarchy. The structure is like

    • org (8 child projects) (<-- here group "manager" is authorized and my account is in that group. So all projects use inherited permissions via hierarchy)
      • a
        • 1 child project
      • b
        • 31 child projects
      • c
        • 3 child projects
      • d
        • 1 child projects
      • e
        • 9 child projects
      • f
        • 3 child projects
      • g
        • 9 child projects
      • h
        • 9 child projects

    Here is an image of transactions using pgadmin4:

    onedev-user-transactions-per-click.png

    I was working as site admin and clicked project filters. Nothing really to see in the image. Then I switched account and loading the projects menu item and clicking on a filter (show all projects). Both produced spikes in transactions/commits. I assume OneDev did many simple read queries all using auto-commit transactions and their time accumulated. Looks like a classic JPA lazy load issue.

    Can I turn on query logs somehow? If not, a script + OneDev API might be a way to create such a project structure here or in your dev environment.

  • Robin Shen commented 2 months ago

    As mentioned above, it will help a lot if you can create and attach a sample OneDev installation demonstrating the issue and attach here, then I can just load it and check.

    You may turn on query log via property hibernate.show_sql in conf/hibernate.properties

  • Robin Shen commented 2 months ago

    The docs note that one can use a custom image for workspaces but it doesn't say if that image must meet any requirements. Does OneDev need some specific packages to be installed, eg. tmux, screen or similar, so it works without issues? For example in my case I have a base image for development purposes with self-signed CA certificate trusted by linux and java and I would like to extend from that image instead of yours

    Check here for image requirements: https://code.onedev.io/onedev/docker/opencode/~files/main/Dockerfile

  • Robin Shen commented 2 months ago

    Removed key stroke permission check in 15.0.4.

  • jbauer commented 1 month ago

    I will create a new issue once I have time to look into the delay/query issue.

  • jbauer commented 1 month ago

    @robin Just tried 15.0.5 and the workspace terminal is fast now. At least we now know that the code you have removed/skipped from the keystroke code path did indeed trigger the slow behavior.

  • Robin Shen commented 1 month ago

    Thanks. Closing this now

  • Robin Shen changed state to 'Closed' 1 month ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (4)
Reference
OD-2747
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover