Skip to content

Commit

Permalink
Merge pull request #132 from FederatedAI/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
forgivedengkai authored Dec 30, 2021
2 parents 5bbfd31 + aca5a65 commit 4c0cbaa
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 51 deletions.
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Release 2.1.3
## Major Features and Improvements
* Fix the HttpAdapter thread leakage problem.
* Upgrade log4j dependent version.

# Release 2.1.2
## Major Features and Improvements
* Fix serious security vulnerabilities in log4j.
Expand Down
4 changes: 2 additions & 2 deletions document/docs/config/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</table>

### route_table配置
下面的json代码大致说明了router_table.json的填写规则,根据具体案例来配置。
下面的json代码大致说明了route_table.json的填写规则,根据具体案例来配置。

>启动注册中心时,只配置默认对外转发地址(default)即可 ;
>在2.1.0版本开始支持HTTP接口配置,2.1.0之前的版本只支持GRPC配置。
Expand Down Expand Up @@ -173,7 +173,7 @@
"default": {
"default": [
{
"url":"http://127.0.0.1:8879/unary"
"url":"http://127.0.0.1:8869/unary"
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions document/docs/example/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ zk.url=192.168.0.1:2181,192.168.0.2:2181,192.168.0.3:2181
proxy.grpc.intra.port=8879
proxy.grpc.inter.port=9370
```
• guest 的serving-proxy router_table.json配置:
• guest 的serving-proxy route_table.json配置:

由于guest的请求只会向外发送,所以只需要配置出口ip端口就好, 如下代码所示只需要配置default转发规则,则会将所有请求转发至出口ip,而出口ip需要与host端proxy.grpc.inter.port对齐。
```yml
Expand Down Expand Up @@ -59,7 +59,7 @@ zk.url=192.134.0.1:2181,192.134.0.2:2181,192.134.0.3:2181
proxy.grpc.intra.port=8879
proxy.grpc.inter.port=9370
```
• host 的serving-proxy router_table.json配置:
• host 的serving-proxy route_table.json配置:
```yml
xxxxxxxxxx
{
Expand Down
18 changes: 11 additions & 7 deletions document/docs/quickstart/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ $ mvn clean package
随后拷贝,比如 serving-server/target/fate-serving-server-{version}-release.zip 到想要部署的路径下,并解压。(version为当前版本号)

用户也可选择下载已编译好的版本,链接如下:
[fate-serving-server-2.1.2-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-server-2.1.2-release.zip)
[fate-serving-proxy-2.1.2-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-proxy-2.1.2-release.zip)
[fate-serving-admin-2.1.2-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-admin-2.1.2-release.zip)
[fate-serving-server-2.1.3-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-server-2.1.3-release.zip)
[fate-serving-proxy-2.1.3-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-proxy-2.1.3-release.zip)
[fate-serving-admin-2.1.3-release.zip](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-admin-2.1.3-release.zip)


### zookeeper部署
Expand Down Expand Up @@ -54,15 +54,17 @@ export PATH=$PATH:$JAVA_HOME/bin

### serving-proxy部署
1.根据需求修改部署目录下 conf/application.properties文件,具体配置项解释见配置文件详解[proxy.md](../config/proxy.md)中application.properties配置。
2.配置router_table.json ,具体配置项解释见文件详解[proxy.md](../config/proxy.md)中route_table配置。
>对router_table.json的修改是定时刷新生效,可以不需要重启serving-proxy;配置本身为json格式,修改时需要注意是否满足json格式。
2.配置route_table.json ,具体配置项解释见文件详解[proxy.md](../config/proxy.md)中route_table配置。
>对route_table.json的修改是定时刷新生效,可以不需要重启serving-proxy;配置本身为json格式,修改时需要注意是否满足json格式。
3.sh service.sh restart (或 ./service.sh restart) 启动应用(windows 脚本暂时不支持,如有需要可自行编写)
有可能出现的问题:
>jdk 没有安装成功,可以尝试执行 java -version 查看java命令是否能正常执行,可在bin/service.sh中指定jdk
```yaml
xxxxxxxxxx
export JAVA_HOME=/data/projects/fate/common/jdk/jdk-8u192
export PATH=$PATH:$JAVA_HOME/bin
>
```
4.检查日志与端口看启动是否正常

### serving-admin部署
Expand All @@ -75,7 +77,9 @@ serving-admin提供了集群的可视化操作界面,可以展示集群中各
2.sh service.sh restart (或 ./service.sh restart) 启动应用(windows 脚本暂时不支持,如有需要可自行编写)
有可能出现的问题:
>jdk 没有安装成功,可以尝试执行 java -version 查看java命令是否能正常执行,可在bin/service.sh中指定jdk
```yaml
xxxxxxxxxx
export JAVA_HOME=/data/projects/fate/common/jdk/jdk-8u192
export PATH=$PATH:$JAVA_HOME/bin
>
```
3.通过浏览器访问admin页面,默认访问地址: [http://127.0.0.1:8350](http://127.0.0.1:8350)
6 changes: 6 additions & 0 deletions document/docs/release/change_log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## FATE-SERVING 2.1.3
```text
1.修复内置HttpAdapter线程泄露问题。
2.升级log4j依赖版本。
```

## FATE-SERVING 2.1.2
```text
1.修复log4j的严重安全漏洞。
Expand Down
12 changes: 7 additions & 5 deletions document/docs/service/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ feature.batch.adaptor=com.webank.ai.fate.serving.adaptor.dataaccess.CustomBatchA
>serving-server部署目录下extension``已加载到类路径

## 预设Adapter
fate-serving-extension中预设了6Adapter的简单实现
fate-serving-extension中预设了6Adapter的简单实现

#### MockAdapter
固定返回mock特征数据
Expand All @@ -63,15 +63,17 @@ fate-serving-extension中预设了6种Adapter的简单实现
用于批量预测,原理同上

#### TestFileAdapter
从host_data.csv种读取特征数据,每次调用返回值为csv种所有内容, host_data.csv需上传至Host方serving-server实例部署根目录下,
从host_data.csv中读取特征数据,每次调用返回值为csv中所有内容, host_data.csv需上传至Host方serving-server实例部署根目录下,
>x0:-0.320167,x1:0.58883,x2:-0.18408,x3:-0.384207,x4:2.201839,x5:1.68401,x6:1.219096,x7:1.150692,x8:1.9656,x9:1.572462,x10:-0.35685
x0:1,x1:5,x2:13,x3:58,x4:95,x5:352,x6:418,x7:833,x8:888,x9:937,x10:32776

#### HttpAdapter
在serving-server.properties文件中配置属性feature.single.adaptor和http.adapter.url,feature.single.adaptor为继承AbstractSingleFeatureDataAdaptor
接口,url为调用获取数据接口地址。
feature.single.adaptor=com..webank.ai.fate.serving.adaptor.dataaccess.HttpAdapter
接口,url为调用获取数据接口地址。
```yaml
feature.single.adaptor=com.webank.ai.fate.serving.adaptor.dataaccess.HttpAdapter
http.adapter.url=http://127.0.0.1:9380/v1/http/adapter/getFeature
```

### HttpBatchAdapter
#### HttpBatchAdapter
用于批量预测,需将feature.single.adaptor配置改为feature.batch.adaptor
8 changes: 4 additions & 4 deletions document/docs/service/client.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FATE-Serving提供了fate-serving-client工具
### 下载对应版本的fate-serving-client
>linux版本:[fate-serving-client-2.1.2-linux.tar.gz](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-client-2.1.2-linux.tar.gz )
>mac版本:[fate-serving-client-2.1.2-darwin.tar.gz](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-client-2.1.2-darwin.tar.gz)
>linux版本:[fate-serving-client-2.1.3-linux.tar.gz](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-client-2.1.3-linux.tar.gz )
>mac版本:[fate-serving-client-2.1.3-darwin.tar.gz](https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate-serving-client-2.1.3-darwin.tar.gz)
需要先确认下载解压出来的文件有没有可执行权限,没有权限就执行 `chmod +777 fate-serving-client-2.1.2-linux`授权。
需要先确认下载解压出来的文件有没有可执行权限,没有权限就执行 `chmod +777 fate-serving-client-2.1.3-linux`授权。

### 启动client
在终端中使用`./fate-serving-client-2.1.2-linux`启动client
在终端中使用`./fate-serving-client-2.1.3-linux`启动client
![connect](../img/client-connect.jpg)

### 提供了以下几种指令
Expand Down
4 changes: 2 additions & 2 deletions fate-serving-admin-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FATE-Serving",
"version": "2.1.2",
"version": "2.1.3",
"private": true,
"author": "FATE Serving",
"scripts": {
Expand Down Expand Up @@ -47,7 +47,7 @@
"sass-loader": "^7.1.0",
"svg-sprite-loader": "^3.9.2",
"vue-template-compiler": "^2.6.10",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-bundle-analyzer": ">=3.3.2",
"webpack-cli": "^3.2.3"
}
}
2 changes: 1 addition & 1 deletion fate-serving-admin/bin/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ basepath=$(cd `dirname $0`;pwd)
configpath=$(cd $basepath/conf;pwd)
module=serving-admin
main_class=com.webank.ai.fate.serving.admin.Bootstrap
module_version=2.1.2
module_version=2.1.3

case "$1" in
start)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.webank.ai.fate.serving.common.health;

public enum HealthCheckItemEnum {
CHECK_ROUTER_FILE("check router_table.json exist",HealthCheckComponent.SERVINGPROXY),
CHECK_ROUTER_FILE("check route_table.json exist",HealthCheckComponent.SERVINGPROXY),
CHECK_ZOOKEEPER_CONFIG("check zk config",HealthCheckComponent.ALL),
CHECK_ROUTER_NET("check router",HealthCheckComponent.SERVINGPROXY),
CHECK_MEMORY_USAGE("check memory usage",HealthCheckComponent.ALL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ public static void initPool() {
requestConfig = RequestConfig.custom().setConnectionRequestTimeout(
connectionRequestTimeout).setSocketTimeout(socketTimeout).setConnectTimeout(
connectTimeout).build();
httpClient = getConnection();
httpClient = createConnection();
} catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException ex) {
logger.error("init http client pool failed:", ex);
}
}

public static CloseableHttpClient getConnection() {
return httpClient;
}

public static CloseableHttpClient createConnection() {
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(poolConnManager)
.setDefaultRequestConfig(requestConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Map;

public class MetaInfo {
public static final long CURRENT_VERSION = 212;
public static final long CURRENT_VERSION = 213;
public static List<AdaptorDescriptor.ParamDescriptor> inferenceParamDescriptorList;
public static List<AdaptorDescriptor.ParamDescriptor> batchInferenceParamDescriptorList;
public static Boolean PROPERTY_REMOTE_MODEL_INFERENCE_RESULT_CACHE_SWITCH;
Expand Down
2 changes: 1 addition & 1 deletion fate-serving-proxy/bin/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ basepath=$(cd `dirname $0`;pwd)
configpath=$(cd $basepath/conf;pwd)
module=serving-proxy
main_class=com.webank.ai.fate.serving.proxy.bootstrap.Bootstrap
module_version=2.1.2
module_version=2.1.3


case "$1" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static JsonObject initRouter() {
// long now = new Date().getTime();
// JsonObject routerJson = loadRoutTable();
// if (routerJson == null) {
// throw new RouterInfoOperateException("router_table.json not exists");
// throw new RouterInfoOperateException("route_table.json not exists");
// }
// JsonObject route_table = routerJson.getAsJsonObject("route_table");
// if (route_table == null) {
Expand Down Expand Up @@ -126,8 +126,8 @@ public static JsonObject initRouter() {
// }
// routerJson.add("route_table", route_table);
// if (writeRouterFile(JsonUtil.formatJson(routerJson.toString()))) {
// logger.error("write router_table.json error");
// throw new RouterInfoOperateException("write router_table.json error");
// logger.error("write route_table.json error");
// throw new RouterInfoOperateException("write route_table.json error");
// }
// } catch (RouterInfoOperateException routerEx) {
// throw new RouterInfoOperateException(routerEx.getMessage());
Expand All @@ -141,7 +141,7 @@ public static JsonObject initRouter() {
// try {
// JsonObject routerJson = loadRoutTable();
// if (routerJson == null) {
// throw new RouterInfoOperateException("router_table.json not exists");
// throw new RouterInfoOperateException("route_table.json not exists");
// }
// JsonObject route_table = routerJson.getAsJsonObject("route_table");
// if (route_table == null) {
Expand All @@ -167,8 +167,8 @@ public static JsonObject initRouter() {
// partyIdRouter.add(routerInfo.getServerType(), serverTypeArray);
// }
// if (writeRouterFile(JsonUtil.formatJson(routerJson.toString()))) {
// logger.error("write router_table.json error");
// throw new RouterInfoOperateException("write router_table.json error");
// logger.error("write route_table.json error");
// throw new RouterInfoOperateException("write route_table.json error");
// }
// } catch (RouterInfoOperateException routerEx) {
// throw new RouterInfoOperateException(routerEx.getMessage());
Expand All @@ -182,7 +182,7 @@ public static JsonObject initRouter() {
// try {
// JsonObject routerJson = loadRoutTable();
// if (routerJson == null) {
// throw new RouterInfoOperateException("router_table.json not exists");
// throw new RouterInfoOperateException("route_table.json not exists");
// }
// JsonObject route_table = routerJson.getAsJsonObject("route_table");
// if (route_table == null) {
Expand All @@ -193,8 +193,8 @@ public static JsonObject initRouter() {
// if (StringUtils.isBlank(routerInfo.getServerType())) {
// route_table.remove(routerInfo.getPartyId());
// if (writeRouterFile(JsonUtil.formatJson(routerJson.toString()))) {
// logger.error("write router_table.json error");
// throw new RouterInfoOperateException("write router_table.json error");
// logger.error("write route_table.json error");
// throw new RouterInfoOperateException("write route_table.json error");
// }
// return;
// }
Expand All @@ -216,8 +216,8 @@ public static JsonObject initRouter() {
// }
// routerJson.add("route_table", route_table);
// if (writeRouterFile(JsonUtil.formatJson(routerJson.toString()))) {
// logger.error("write router_table.json error");
// throw new RouterInfoOperateException("write router_table.json error");
// logger.error("write route_table.json error");
// throw new RouterInfoOperateException("write route_table.json error");
// }
// } catch (RouterInfoOperateException routerEx) {
// throw new RouterInfoOperateException(routerEx.getMessage());
Expand All @@ -230,17 +230,17 @@ public static JsonObject initRouter() {
public static void saveRouter(String routerInfo){
try {
if (!RouteTableJsonValidator.isJSON(routerInfo)) {
logger.error("validate router_table.json format error");
logger.error("validate route_table.json format error");
}
} catch (Exception e) {
throw new RouterInfoOperateException("validate router_table.json format error:" + e.getMessage());
throw new RouterInfoOperateException("validate route_table.json format error:" + e.getMessage());
}
try {
if (writeRouterFile(JsonUtil.formatJson(routerInfo))) {
logger.error("write router_table.json fail");
logger.error("write route_table.json fail");
}
} catch (Exception e) {
throw new RouterInfoOperateException("router_table.json : " + e.getMessage());
throw new RouterInfoOperateException("route_table.json : " + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ private void checkRouterInfo(HealthCheckResult healthCheckResult){

healthCheckResult.getRecords().add(new HealthCheckRecord(HealthCheckItemEnum.CHECK_ROUTER_FILE.getItemName(),"check router file : no router info found",HealthCheckStatus.error));

// healthCheckResult.getErrorList().add("check router_table.json "+": no router info found");
// healthCheckResult.getErrorList().add("check route_table.json "+": no router info found");
}else{
healthCheckResult.getRecords().add(new HealthCheckRecord(HealthCheckItemEnum.CHECK_ROUTER_FILE.getItemName(),"check router file : router info is found",HealthCheckStatus.ok));

// healthCheckResult.getOkList().add("check router_table.json "+": router_table.json is found");
// healthCheckResult.getOkList().add("check route_table.json "+": route_table.json is found");
}

routerInfoCheck(healthCheckResult);
Expand Down Expand Up @@ -221,7 +221,7 @@ public HealthCheckResult check(Context context) {
return healthCheckComponent == HealthCheckComponent.ALL || healthCheckComponent == HealthCheckComponent.SERVINGPROXY;
}).forEach((item) -> {
switch (item) {
// CHECK_ROUTER_FILE("check router_table.json exist",HealthCheckComponent.SERVINGPROXY),
// CHECK_ROUTER_FILE("check route_table.json exist",HealthCheckComponent.SERVINGPROXY),
// CHECK_ZOOKEEPER_CONFIG("check zk config",HealthCheckComponent.ALL),
// CHECK_ROUTER_NET("check router",HealthCheckComponent.SERVINGPROXY),
// CHECK_MEMORY_USAGE("check memory usage",HealthCheckComponent.ALL),
Expand Down
2 changes: 1 addition & 1 deletion fate-serving-proxy/src/main/resources/route_table.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"default": [
{
"ip": "127.0.0.1",
"port": 8879,
"port": 8869,
"useSSL": false
}
]
Expand Down
2 changes: 1 addition & 1 deletion fate-serving-server/bin/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ basepath=$(cd `dirname $0`;pwd)
configpath=$(cd $basepath/conf;pwd)
module=serving-server
main_class=com.webank.ai.fate.serving.Bootstrap
module_version=2.1.2
module_version=2.1.3


case "$1" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ zk.url=localhost:2181,localhost:2182,localhost:2183
# zk acl
#acl.enable=false
#acl.username=
#acl.password=
#acl.password=

# LR algorithm config
#lr.split.size=500
#lr.use.parallel=false
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</modules>

<properties>
<fate.version>2.1.2</fate.version>
<fate.version>2.1.3</fate.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand All @@ -50,7 +50,7 @@
<spring.boot.version>2.2.0.RELEASE</spring.boot.version>
<jackson.version>2.10.0</jackson.version>
<jedis.version>2.9.0</jedis.version>
<log4j2.version>2.16.0</log4j2.version>
<log4j2.version>2.17.0</log4j2.version>
<skipTests>true</skipTests>
</properties>

Expand Down

0 comments on commit 4c0cbaa

Please sign in to comment.