Browse Source

Serving, add master and worker async handle time cost

tags/v1.2.0
xuyongfei 5 years ago
parent
commit
a8c6b08c01
4 changed files with 11 additions and 6 deletions
  1. +0
    -2
      mindspore_serving/ccsrc/master/dispacther.cc
  2. +6
    -1
      mindspore_serving/ccsrc/master/grpc/grpc_server.h
  3. +0
    -2
      mindspore_serving/ccsrc/worker/grpc/worker_process.cc
  4. +5
    -1
      mindspore_serving/ccsrc/worker/grpc/worker_server.h

+ 0
- 2
mindspore_serving/ccsrc/master/dispacther.cc View File

@@ -80,9 +80,7 @@ void Dispatcher::DispatchAsync(const proto::PredictRequest &request, proto::Pred
this->infer_num_--;
};
infer_num_++;
MSI_TIME_STAMP_START(Predict)
status = DispatchAsyncInner(request, reply, callback);
MSI_TIME_STAMP_END(Predict)
} catch (const std::bad_alloc &ex) {
MSI_LOG(ERROR) << "Serving Error: malloc memory failed";
std::cout << "Serving Error: malloc memory failed" << std::endl;


+ 6
- 1
mindspore_serving/ccsrc/master/grpc/grpc_server.h View File

@@ -94,7 +94,12 @@ class MasterPredictContext : public MasterServiceContext {
void HandleRequest() override {
EnqueueRequest(service_impl_, async_service_, cq_);
state_ = STATE::FINISH;
PredictOnFinish on_finish = [this]() { responder_.Finish(response_, grpc::Status::OK, this); };
MSI_TIME_STAMP_START(RequestHandle)
PredictOnFinish on_finish = [this, time_start_RequestHandle]() {
responder_.Finish(response_, grpc::Status::OK, this);
MSI_TIME_STAMP_END(RequestHandle)
};
service_impl_->PredictAsync(&request_, &response_, on_finish);
}


+ 0
- 2
mindspore_serving/ccsrc/worker/grpc/worker_process.cc View File

@@ -32,9 +32,7 @@ void MSWorkerImpl::PredictAsync(grpc::ServerContext *context, const proto::Predi
Status status(FAILED);
MSI_LOG(INFO) << "Begin call service Eval";
try {
MSI_TIME_STAMP_START(Predict)
status = Worker::GetInstance().RunAsync(*request, reply, on_finish);
MSI_TIME_STAMP_END(Predict)
} catch (const std::bad_alloc &ex) {
MSI_LOG(ERROR) << "Serving Error: malloc memory failed";
std::cout << "Serving Error: malloc memory failed" << std::endl;


+ 5
- 1
mindspore_serving/ccsrc/worker/grpc/worker_server.h View File

@@ -100,7 +100,11 @@ class WorkerPredictContext : public WorkerServiceContext {
void HandleRequest() override {
EnqueueRequest(service_impl_, async_service_, cq_);
state_ = STATE::FINISH;
PredictOnFinish on_finish = [this]() { responder_.Finish(response_, grpc::Status::OK, this); };
MSI_TIME_STAMP_START(WorkerRequestHandle)
PredictOnFinish on_finish = [this, time_start_WorkerRequestHandle]() {
responder_.Finish(response_, grpc::Status::OK, this);
MSI_TIME_STAMP_END(WorkerRequestHandle)
};
service_impl_->PredictAsync(&ctx_, &request_, &response_, on_finish);
}


Loading…
Cancel
Save