开发者

How do I go about setting up an application so that it has a persistent process in memory and does not have to re-initialize to run?

开发者 https://www.devze.com 2022-12-23 06:30 出处:网络
I\'m not sure what\'s the appropriate terminology here, but I\'d like to have an application running passively that is ready to accept commands without having to reinitialize the whole thing.

I'm not sure what's the appropriate terminology here, but I'd like to have an application running passively that is ready to accept commands without having to reinitialize the whole thing.

The precise application is a machine learning system written in Python that takes a somewhat long time to train a classifier or to load a cached classifier.开发者_如何学Go Once the classifier is loaded into memory, test cases or predictions made by the classifier happen very quickly.

I want to have to speed advantage of having the classifier already loaded into memory without having to reclassify/reload so that I can access the classifier quickly through other interfaces (command line, PHP, etc.).

This reminds me of asynchrony in Javascript, and I imagine some of the same underlying concepts are used here.

What's the best way to go about doing this?


Depending on your implementation this is known as a server process, a daemon, a Windows service etc.

A typical implementation will run and accept incoming network connections and service those for clients (e.g. an HTTP server). Some threading or other asynchronous mechanism will exist to allow servicing of multiple clients simultaneously (you may not need this, depending on your requirements).

0

精彩评论

暂无评论...
验证码 换一张
取 消