Comments (16)
I wonder if we are running into limitations of Python. Does uwsgi support other language bindings, like C or Java?
from treelite.
That's great to hear. Let me know if you have other questions.
from treelite.
Are you using predict()
or predict_instance()
?
from treelite.
I use the predict()
method. There is no predict_instance()
method in version 0.32 release
from treelite.
No matter how many workers I use, the CPU usage is always on 6% (100/16, the machine has 16 cores)
from treelite.
Since you have multiple concurrent requests, you should install the latest master and use predict_instance()
.
from treelite.
Is it said that the predict method can not be deployed with multiprocess? And is there any documents to explain the reasons?
Because one request in my application needs to predict multiple instances(8-24), I think that using predict method to predict them is a more elegant solution.
from treelite.
How many threads are calling predict()
simultaneously? The predict()
method is not designed to be called by multiple threads. This is because predict()
method performs batch prediction, where each request has a large batch of instances (100, 1000, or more) and the group of worker threads operate on one request at a time. That means that you cannot have more than one request performed using predict()
. The Java API doc does mention this fact (see here) but the Python API doc does not. Sorry about the confusion, and let me update the Python API doc.
Note that predict_instance()
can be called by multiple threads, and with predict_instance()
multiple requests can be run simultaneously.
Because one request in my application needs to predict multiple instances(8-24), I think that using predict method to predict them is a more elegant solution.
The number of instances is not high enough to warrant batch prediction. You should use predict_instance()
.
from treelite.
I updated the documentation: https://treelite.readthedocs.io/en/latest/treelite-runtime-api.html#treelite.runtime.Predictor.predict
from treelite.
I try the predict_instance
method, but it is slower than original xgboost.predict
(not treelite predict) to predict one instance (it took 65ms but original xgboost.predict
only took 20ms). Is there any better way to perform higher concurrent and qps?
from treelite.
@idiomer Does it scale with respect to number of threads?
from treelite.
Also, you can try creating a batch from multiple incoming requests
from treelite.
@hcho3 predict_instance
performs as predict
method. I use uwsgi to open 8 precess(workers) to serve, and use apache ab with multiple threads(1, 8, 30) to request my server. But 8 workers only use 100%(=12.5%*8) CPU, not 800% CPU.
Below is the screenshot of top command:
from treelite.
I would like to work with you closely to improve performance for concurrent requests
from treelite.
Also, can you.post a dummy data example that I can run on my end? I'd like to learn more about use cases like yours and make taegeted improvements.
from treelite.
I wonder if we are running into limitations of Python. Does uwsgi support other language bindings, like C or Java?
Just now, I try to run my application with multiple ports without uwsgi. It works! I can use predict
method to process the concurrent requests.
So, I think that uwsgi doesn't support other language bindings.
Thank you very much for your advice and patience.
from treelite.
Related Issues (20)
- treelite::ConcatenateModelObjects() ought to set threshold_type and leaf_output_type fields
- Clean up serialization logic
- Support XGBoost gblinear Booster HOT 1
- Release version 3.3.0
- Release version 3.4.0
- Replace setup.py with pyproject.toml
- Treelite crashes with XGBoost 2.0 dev
- Document Treelite serialization format.
- Adopt Four-Document System to organize docs
- Refactor sklearn loader using mix-in classes
- Implement v4 serialization format
- Revamp JSON importer to make it easy to use
- Drop "max_index" postprocessor
- Add directory exist check in _load_lib for add_dll_directory HOT 1
- scikit-learn 1.4.0 breaks unit test HOT 1
- Multi-class, multi-output RandomForestClassifier in scikit-learn produces error
- Test multi-target models where each tree predicts multiple regression targets HOT 1
- Export model back to scikit-learn HOT 1
- NumPy 2.0 support HOT 4
- xgboost json model fails to load HOT 3
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 treelite.