tensorflow_serving/g3doc/saved_model_warmup.md
The TensorFlow runtime has components that are lazily initialized, which can cause high latency for the first request/s sent to a model after it is loaded. This latency can be several orders of magnitude higher than that of a single inference request.
To reduce the impact of lazy initialization on request latency, it's possible to trigger the initialization of the sub-systems and components at model load time by providing a sample set of inference requests along with the SavedModel. This process is known as "warming up" the model.
SavedModel Warmup is supported for Regress, Classify, MultiInference and Predict. To trigger warmup of the model at load time, attach a warmup data file under the assets.extra subfolder of the SavedModel directory.
Requirements for model warmup to work correctly:
Warmup data can be added in two ways:
YourSavedModel/assets.extra/tf_serving_warmup_requests.YourSavedModel/assets.extra/tf_serving_warmup_requests based on the
validation requests provided via
RequestSpec.