Comments (1)
Hi, first I recommend using other algorithms such as LZ4 or Brotli if it's possible for you because LZMA itself or maybe the current implementation (LZMA-SDK package) that EasyCompressor uses is not so efficient (both in CPU usage and Memory usage).
Just so you know, if you decide to use Brotli make sure to use the .NET built-in Brotli implementation which is included in EasyCompressor package (not the EasyCompressor.BrotliNET).
Also, make sure to use CompressionLevel.Optimal
(that is by default in EasyCompressor) because the CompressionLevel.SmallestSize
takes too long to process and is not cost-effective.
By the way, there is no way to throttle only a method in .NET to limit CPU or Memory usage.
But If you use orchestrators like Kubernetes or Cloud-based infrastructures you can limit your CPU Cores.
You can also limit your Entire Process through Windows by setting Process Priority to Low and Process Affinity to Minimum CPU Cores (like this or by third-party apps)
However, I think can't limit your Memory usage because if you don't have enough memory you will run into OutOfMemoryException
You can do the same using C# by setting Priority and Affinity of your Current Process
or ProcessThread
like this:
Process currentProcess = Process.GetCurrentProcess();
currentProcess.PriorityClass = ProcessPriorityClass.Idle; //Low
int affinityHex = 0x0002; // use only the second processor, despite availability
//affinityHex = 0x000F; // use only any of the first 4 available processors
currentProcess.ProcessorAffinity = affinityHex;
//ProcessThread processThread = currentProcess.Threads[0];
//processThread.PriorityLevel = ThreadPriorityLevel.Idle;
//processThread.ProcessorAffinity = affinityHex;
Note: The value of affinity is hex-base and you must calculate it based on which CPU Core/s you want to be available for this process. (more info and here)
from easycompressor.
Related Issues (9)
- EasyCompressor and EasyCaching HOT 1
- How to decompress a .tar.lz4
- Crash in compressor for larger objects? HOT 3
- Incompatibility Issue Between EasyCompressor Versions 1.4.0 and 2.0.2 Resulting in Corrupted Pickle (LZ4) HOT 2
- BrotliCompressor for FW 4.8 HOT 5
- Arithmetic operation resulted in an overflow. HOT 6
- Possibly add ZPAQ or other compressors? HOT 4
- Brotli,Deflate,GZIP closes stream too early. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easycompressor.