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

com.alibaba.csp.sentinel.util.TimeUtil high CPU usage #1702

Closed
wenit opened this issue Aug 28, 2020 · 1 comment · Fixed by #1746
Closed

com.alibaba.csp.sentinel.util.TimeUtil high CPU usage #1702

wenit opened this issue Aug 28, 2020 · 1 comment · Fixed by #1746
Labels
area/performance Issues or PRs related to runtime performance kind/enhancement Category issues or prs related to enhancement.

Comments

@wenit
Copy link

wenit commented Aug 28, 2020

Issue Description

Type: bug report or feature request

Describe what happened (or what feature you want)

com.alibaba.csp.sentinel.util.TimeUtil 中死循环,占用了50%左右的cpu

代码如下:

static {
        currentTimeMillis = System.currentTimeMillis();
        Thread daemon = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    currentTimeMillis = System.currentTimeMillis();
                    try {
                        TimeUnit.MILLISECONDS.sleep(1);
                    } catch (Throwable e) {

                    }
                }
            }
        });
        daemon.setDaemon(true);
        daemon.setName("sentinel-time-tick-thread");
        daemon.start();
    }

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

sentinel版本1.7.1

redhat7.4

jdk1.8

Anything else we need to know?

@sczyh30 sczyh30 changed the title cpu使用率高 com.alibaba.csp.sentinel.util.TimeUtil high CPU usage Aug 31, 2020
@sczyh30 sczyh30 added the kind/question Category issues related to questions or problems label Aug 31, 2020
@jasonjoo2010
Copy link
Collaborator

Is it necessary to improve TimeUtil as self adjustable model? @sczyh30

Kind of initial thought:

Screen Shot 2020-09-14 at 23 55 49

@sczyh30 sczyh30 added area/performance Issues or PRs related to runtime performance and removed kind/question Category issues related to questions or problems labels Nov 6, 2020
@sczyh30 sczyh30 added the kind/enhancement Category issues or prs related to enhancement. label Jun 29, 2021
CST11021 pushed a commit to CST11021/Sentinel that referenced this issue Nov 3, 2021

Verified

This commit was signed with the committer’s verified signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance Issues or PRs related to runtime performance kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants