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

download_to_file Process is very use Cpu #479

Closed
aradariya opened this issue Aug 9, 2018 · 10 comments
Closed

download_to_file Process is very use Cpu #479

aradariya opened this issue Aug 9, 2018 · 10 comments

Comments

@aradariya
Copy link

$MadelineProto->download_to_file

this opration used 25% of CPU my Windows server
2 core 3.40 GHz

i use MultiThreading For Downloads Process . 4 Process use 100% of My Cpu !!
pls help me for this :(

@danog
Copy link
Owner

danog commented Aug 13, 2018

  1. Use linux to reduce CPU usage
  2. Install the openssl and gmp extensions
  3. MadelineProto does not support multihreading with pthreads; use multiprocessing instead

@danog danog closed this as completed Aug 13, 2018
@aradariya
Copy link
Author

@danog
i test it downt work
how to change $part_size to 1024*256 ?
1024*1024 =>Download speed fast and High CPU Usage

after save madeline.phar script dont work - (utf8 encoding and other )

@danog
Copy link
Owner

danog commented Aug 14, 2018

Reducing the part_size will only slow down downloading and increase overhead (=> CPU usage will greatly increase).
Are you sure you tried running on a Linux server with the gmp and openssl extensions installed?

@aradariya
Copy link
Author

aradariya commented Aug 14, 2018

@danog
yeah i run script in linux ,does not change cpu performance
i test part_size in other similar lib - when change part_size usage cpu is changed such as tlsharp and ...
in my Servers with cpu: 2 core 3.40 GHz

1024*124 = > 10% Cpu
1024*256= > 15% Cpu
1024*512= > 20% Cpu
1024*1024= > 25% Cpu

now i cant save madeline.phar after saving script dont work.

Fatal error: Uncaught PharException: phar "C:\xampp\htdocs\BotDl\madeline.phar" SHA1 signature could not be verified: broken signature in C:\xampp\htdocs\BotDl\madeline.phar:11 Stack trace: #0 C:\xampp\htdocs\BotDl\madeline.phar(11): Phar::mapPhar('madeline.phar') #1 C:\xampp\htdocs\BotDl\madeline.php(24): require('C:\xampp\htdocs...') #2 C:\xampp\htdocs\BotDl\index.php(9): include_once('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\BotDl\madeline.phar on line 11

@danog
Copy link
Owner

danog commented Aug 14, 2018

Have you installed the openssl and GMP extensions?

@danog
Copy link
Owner

danog commented Aug 14, 2018

MadelineProto is very different from other libraries, and decreasing the part_size in MadelineProto GREATLY increases CPU usage; install openssl and GMP to reduce CPU usage.

@aradariya
Copy link
Author

aradariya commented Aug 16, 2018

photo_ - - _ - -

openssl and GMP installed , usage 60% of cpu
@danog

@aradariya
Copy link
Author

@danog
are you haven't any idea ?

@danog
Copy link
Owner

danog commented Aug 23, 2018

Are you sure you've installed the openssl extension? What does var_dump(extension_loaded('openssl')); say?

@danog
Copy link
Owner

danog commented Aug 23, 2018

Also, high CPU usage isn't really a problem, since the kernel really does a good job at scheduling the processes, to make sure everyone gets their time slice.

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

2 participants