Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
dc9ca498
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dc9ca498
编写于
9月 05, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix conflicts
Former-commit-id: 117e31f7cfff33e1b5716e60e4521faa0ef4ecee
上级
c4536f0d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
27 deletion
+22
-27
cpp/src/server/grpc_impl/GrpcMilvusServer.cpp
cpp/src/server/grpc_impl/GrpcMilvusServer.cpp
+22
-27
未找到文件。
cpp/src/server/grpc_impl/GrpcMilvusServer.cpp
浏览文件 @
dc9ca498
...
...
@@ -25,6 +25,7 @@
#include <grpcpp/security/credentials.h>
#include <grpcpp/grpcpp.h>
namespace
zilliz
{
namespace
milvus
{
namespace
server
{
...
...
@@ -36,11 +37,11 @@ constexpr long MESSAGE_SIZE = -1;
class
NoReusePortOption
:
public
::
grpc
::
ServerBuilderOption
{
public:
void
UpdateArguments
(
::
grpc
::
ChannelArguments
*
args
)
override
{
void
UpdateArguments
(
::
grpc
::
ChannelArguments
*
args
)
override
{
args
->
SetInt
(
GRPC_ARG_ALLOW_REUSEPORT
,
0
);
}
void
UpdatePlugins
(
std
::
vector
<
std
::
unique_ptr
<::
grpc
::
ServerBuilderPlugin
>>*
void
UpdatePlugins
(
std
::
vector
<
std
::
unique_ptr
<::
grpc
::
ServerBuilderPlugin
>>
*
plugins
)
override
{}
};
...
...
@@ -52,38 +53,32 @@ GrpcMilvusServer::StartService() {
StopService
();
}
try
{
ServerConfig
&
config
=
ServerConfig
::
GetInstance
();
ConfigNode
server_config
=
config
.
GetConfig
(
CONFIG_SERVER
);
ConfigNode
engine_config
=
config
.
GetConfig
(
CONFIG_ENGINE
);
std
::
string
address
=
server_config
.
GetValue
(
CONFIG_SERVER_ADDRESS
,
"127.0.0.1"
);
int32_t
port
=
server_config
.
GetInt32Value
(
CONFIG_SERVER_PORT
,
19530
);
faiss
::
distance_compute_blas_threshold
=
engine_config
.
GetInt32Value
(
CONFIG_DCBT
,
20
);
ServerConfig
&
config
=
ServerConfig
::
GetInstance
();
ConfigNode
server_config
=
config
.
GetConfig
(
CONFIG_SERVER
);
ConfigNode
engine_config
=
config
.
GetConfig
(
CONFIG_ENGINE
);
std
::
string
address
=
server_config
.
GetValue
(
CONFIG_SERVER_ADDRESS
,
"127.0.0.1"
);
int32_t
port
=
server_config
.
GetInt32Value
(
CONFIG_SERVER_PORT
,
19530
);
std
::
string
server_address
(
address
+
":"
+
std
::
to_string
(
port
)
);
faiss
::
distance_compute_blas_threshold
=
engine_config
.
GetInt32Value
(
CONFIG_DCBT
,
20
);
::
grpc
::
ServerBuilder
builder
;
builder
.
SetOption
(
std
::
unique_ptr
<::
grpc
::
ServerBuilderOption
>
(
new
NoReusePortOption
));
builder
.
SetMaxReceiveMessageSize
(
MESSAGE_SIZE
);
//default 4 * 1024 * 1024
builder
.
SetMaxSendMessageSize
(
MESSAGE_SIZE
);
std
::
string
server_address
(
address
+
":"
+
std
::
to_string
(
port
));
builder
.
SetCompressionAlgorithmSupportStatus
(
GRPC_COMPRESS_STREAM_GZIP
,
true
);
builder
.
SetDefaultCompressionAlgorithm
(
GRPC_COMPRESS_STREAM_GZIP
);
builder
.
SetDefaultCompressionLevel
(
GRPC_COMPRESS_LEVEL_HIGH
);
::
grpc
::
ServerBuilder
builder
;
builder
.
SetOption
(
std
::
unique_ptr
<::
grpc
::
ServerBuilderOption
>
(
new
NoReusePortOption
));
builder
.
SetMaxReceiveMessageSize
(
MESSAGE_SIZE
);
//default 4 * 1024 * 1024
builder
.
SetMaxSendMessageSize
(
MESSAGE_SIZE
);
GrpcRequestHandler
service
;
builder
.
SetCompressionAlgorithmSupportStatus
(
GRPC_COMPRESS_STREAM_GZIP
,
true
);
builder
.
SetDefaultCompressionAlgorithm
(
GRPC_COMPRESS_STREAM_GZIP
);
builder
.
SetDefaultCompressionLevel
(
GRPC_COMPRESS_LEVEL_HIGH
);
builder
.
AddListeningPort
(
server_address
,
::
grpc
::
InsecureServerCredentials
());
builder
.
RegisterService
(
&
service
);
GrpcRequestHandler
service
;
server
=
builder
.
BuildAndStart
(
);
server
->
Wait
(
);
builder
.
AddListeningPort
(
server_address
,
::
grpc
::
InsecureServerCredentials
()
);
builder
.
RegisterService
(
&
service
);
}
catch
(
std
::
exception
&
ex
)
{
SERVER_LOG_ERROR
<<
"Milvus server encounter exception: "
<<
std
::
string
(
ex
.
what
())
<<
"Is another server instance running?"
;
}
server
=
builder
.
BuildAndStart
();
server
->
Wait
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录