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

CPU usage is quite time-consuming.(NativeUnixSocket.receive) #164

Open
wzfxue opened this issue Dec 20, 2024 · 2 comments
Open

CPU usage is quite time-consuming.(NativeUnixSocket.receive) #164

wzfxue opened this issue Dec 20, 2024 · 2 comments
Assignees
Labels
information needed More information is required

Comments

@wzfxue
Copy link

wzfxue commented Dec 20, 2024

Describe the bug

I'm sorry, I'm not quite sure what caused the CPU usage to be particularly high.
Can you help me check if there is a problem with the code writing?

To Reproduce
Steps to reproduce the behavior:

  1. com.sdtp.uds.JmsServer
  2. com.sdtp.uds.JmsClient
    
    Expected behavior
    I am running JmsServer and JmsClient with 12 threads on a 48 core CPU host, which can generate approximately 4TB of data per minute, but the CPU usage is nearly 17%.
    
    Output/Screenshots
    If applicable, add console output/screenshots to help explain your problem.
    
    
    Notes
    Add any other context about the problem here. Please link/attach any source code that is useful to diagnose the issue.
    com.kohlschutter.junixsocket:junixsocket-native-common:2.10.1

image

JmsClient.java.txt
JmsServer.java.txt

@kohlschuetter
Copy link
Member

I'm not sure I understand your concern, please clarify:

Your CPU is transferring 4 TB per Minute (68 GB per second), which you say it's 17% of your CPU, so 83% of your CPU is idle.

Doesn't sound too bad to me, especially when looking at what the code does.

Have you tried benchmarking it against some other implementation?

@kohlschuetter kohlschuetter added the information needed More information is required label Jan 6, 2025
@wzfxue
Copy link
Author

wzfxue commented Jan 10, 2025

I'm not sure I understand your concern, please clarify:

Your CPU is transferring 4 TB per Minute (68 GB per second), which you say it's 17% of your CPU, so 83% of your CPU is idle.

Doesn't sound too bad to me, especially when looking at what the code does.

Have you tried benchmarking it against some other implementation?


Yes, I compared it with Java sockets, and for the same amount of data transmission, using TCP only takes up about 5% of the CPU. Perhaps it's because Unix domain sockets have low performance due to file system swapping, right?

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

No branches or pull requests

2 participants