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异常使用问题 #19

Open
pengbotao opened this issue Jun 25, 2019 · 0 comments
Open

CPU异常使用问题 #19

pengbotao opened this issue Jun 25, 2019 · 0 comments

Comments

@pengbotao
Copy link

通过排查发现这个方法会导致CPU偏高,如果fread调整为1M和10M估计有3-4倍的差异。但1M可能出现大日志写不全的问题。

File: aliyun-log-php-sdk/blob/master/Aliyun/Log/Util.php

    public static function toBytes($logGroup) {
        $mem = fopen("php://memory", "rwb");
        $logGroup->write($mem);
        rewind($mem);
        $bytes="";
      
        if(feof($mem)===false){
            $bytes = fread($mem, 10*1024*1024);
        }
        fclose($mem);
        return $bytes;
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

No branches or pull requests

1 participant