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

created debugging-harperdb.md file #117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Keyology
Copy link
Contributor

Hey @kriszyp @jcohen-hdb,

I created a PR to push this forward please let me know if there are any changes you would like made.

Copy link
Contributor

@jcohen-hdb jcohen-hdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kriszyp I'd definitely like your eyes on this as well. A lot of this stuff isn't really my wheelhouse, hence all the questions.

@Keyology In order to make this page visible in the navigation, you'll need to add it to the SUMMARY.md file

@@ -0,0 +1,44 @@
# Debugging HarperDB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think somewhere up here we need to add some context around what kinds of debugging this is referring to. @kriszyp This information would be specifically for self-managed deployments, correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for remote connection to servers that you have SSH access to and access to the ports.


To learn more, please visit: [HarperDB Configuration - Threads](https://docs.harperdb.io/docs/deployments/configuration#threads)

In most deployments, debugging is already enabled. If it's set up, you can connect to HarperDB using Node DevTools, available via `chrome://inspect` in Chrome (click "Open dedicated DevTools for Node").
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be true in "most deployments" or is that referring to how we do our deployments? Not sure if this conflicts with what is in our config or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct Jake, this is definitely not true for most deployments, it is only for our deployments, for our engineers.
In 4.4, with dev defaults on install, debug is enabled, but not with a starting port range, as is assumed in this doc.
If you are running inside a docker container, you have to enable a range of ports, which is somewhat of an elaborate process itself.


Since DevTools can only connect to one thread per port, we assign specific ports for debugging:

- Main thread: Port 9229
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.harperdb.io/docs/deployments/configuration#threads
This shows debug.port as 9249? Also it mentions startingPort, which is not in the sample config. Not sure if that's directly relevant to this, but seems like it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update those docs to be 9229, that is much more standard. But this should be clarified that this is connects to the ports configured in the starting port range.

When debugging a specific HarperDB instance, you’ll need to SSH into the instance using port tunneling. Here's how to connect to worker threads 1 and 2 (typically, debugging the main thread isn't needed since it doesn’t handle traffic):

```bash
ssh -L 9230:localhost:9230 -L 9231:localhost:9231 [email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we'd want harperdbcloud.com examples in the public docs, but that may be my misunderstanding.

Copy link
Member

@kriszyp kriszyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that potentially more interesting content/approach would be looking at different IDEs (VSCode, WebStorm, Devtools), and how to configure them, with follow-up steps for what needs to be configured for each (for example, you don't need starting range for VSCode and Webstorm, but you do for Devtools).
Unfortunately, taking a post that was intended for a complete different audience, and turning into docs, isn't a great way to write docs, sorry you got dragged into this.

@@ -0,0 +1,44 @@
# Debugging HarperDB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for remote connection to servers that you have SSH access to and access to the ports.


To learn more, please visit: [HarperDB Configuration - Threads](https://docs.harperdb.io/docs/deployments/configuration#threads)

In most deployments, debugging is already enabled. If it's set up, you can connect to HarperDB using Node DevTools, available via `chrome://inspect` in Chrome (click "Open dedicated DevTools for Node").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct Jake, this is definitely not true for most deployments, it is only for our deployments, for our engineers.
In 4.4, with dev defaults on install, debug is enabled, but not with a starting port range, as is assumed in this doc.
If you are running inside a docker container, you have to enable a range of ports, which is somewhat of an elaborate process itself.


Since DevTools can only connect to one thread per port, we assign specific ports for debugging:

- Main thread: Port 9229
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update those docs to be 9229, that is much more standard. But this should be clarified that this is connects to the ports configured in the starting port range.

Comment on lines +16 to +21
- And so on for additional worker threads.

To debug multiple threads, you'll need to register each port in DevTools:

1. In the "Connections" tab, click "Add connection."
2. Add `localhost:9230`, `localhost:9231`, and any other necessary ports.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would someone know how many threads they are using? Is there a way to get dev tools to connect to all threads without manually adding each connection?

Comment on lines +42 to +44
- Run a Performance Profile: To investigate performance issues, start by running a profile for about 10-30 seconds. This will help you identify bottlenecks when analyzing the results.

- Check Memory Usage: For memory-related issues, take a heap snapshot to spot any large memory allocations. You can also compare heap usage over time to track memory growth or leaks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets include some links here about how to analyze a performance profile or heap snapshot results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants