I have a restfull webservice that requires loading trained model files and to create some other objects and it takes lots of time. Therefore I need to do this only once (when starting the webservice). Currently the system loads trained files and some other objects at each webservice call and it is costly. Can you please tell me how to handle this problem?
I have a restfull webservice that requires loading trained model files and to create
Share
You could use the Singleton pattern. It is used to make sure that certain resources are created only once. So basically, you could have one class whose purpose is to instantiate these files and have the webservices call this class, something like so (taken from Wikipedia):
}
Then, in your webservice you could do something like so: