Giter Club home page Giter Club logo

Comments (16)

hcho3 avatar hcho3 commented on July 28, 2024 1

I wonder if we are running into limitations of Python. Does uwsgi support other language bindings, like C or Java?

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024 1

That's great to hear. Let me know if you have other questions.

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024

Are you using predict() or predict_instance()?

from treelite.

idiomer avatar idiomer commented on July 28, 2024

I use the predict() method. There is no predict_instance() method in version 0.32 release

from treelite.

idiomer avatar idiomer commented on July 28, 2024

No matter how many workers I use, the CPU usage is always on 6% (100/16, the machine has 16 cores)

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024

Since you have multiple concurrent requests, you should install the latest master and use predict_instance().

from treelite.

idiomer avatar idiomer commented on July 28, 2024

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.

hcho3 avatar hcho3 commented on July 28, 2024

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.

hcho3 avatar hcho3 commented on July 28, 2024

I updated the documentation: https://treelite.readthedocs.io/en/latest/treelite-runtime-api.html#treelite.runtime.Predictor.predict

from treelite.

idiomer avatar idiomer commented on July 28, 2024

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.

hcho3 avatar hcho3 commented on July 28, 2024

@idiomer Does it scale with respect to number of threads?

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024

Also, you can try creating a batch from multiple incoming requests

from treelite.

idiomer avatar idiomer commented on July 28, 2024

@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:
image

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024

I would like to work with you closely to improve performance for concurrent requests

from treelite.

hcho3 avatar hcho3 commented on July 28, 2024

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.

idiomer avatar idiomer commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.