You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/06/16 09:03:53 UTC

[servicecomb-java-chassis] branch master updated (4065b34 -> 2c7aa7c)

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


    from 4065b34  [SCB-1997] Small improvement when Muticastscoket receive data
     new ba6db76  [SCB-2000]schema discovery working in edge service
     new 331471e  [SCB-2000]add edge docker image and set work pool name
     new 86325a3  [SCB-2000]need catch exception and on failure not processing it
     new 7f7baf9  [SCB-2000]give a name to easy analyses stack
     new e62d35c  [SCB-2000]add license to file
     new 2c7aa7c  [SCB-2000]make Completable future code more simpler

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/servicecomb/core/SCBEngine.java     | 18 ++++++++++
 .../README.md                                      |  6 +++-
 .../pom.xml                                        |  2 +-
 .../{Application.java => ClientApplication.java}   |  4 +--
 .../pom.xml                                        | 14 +++++---
 .../demo/zeroconfig/edge/EdgeApplication.java}     |  6 ++--
 .../demo/zeroconfig/edge}/SelfServiceInvoker.java  |  4 +--
 .../demo/zeroconfig/edge}/ServerEndpoint.java      |  5 ++-
 .../src/main/resources/application.yml             | 22 ++++++++++---
 .../src/main/resources/logback.xml                 |  0
 .../pom.xml                                        | 27 ++++++++++++---
 .../demo/zeroconfig/tests/ServerTest.java          | 38 +++++++++++++++++++---
 .../ClientServerEndpoint.yaml                      | 33 ++++++++++++-------
 .../src/main/resources/registry.yaml               | 12 ++++++-
 .../pom.xml                                        |  5 +--
 .../client/ConfigCenterHttpClientOptionsSPI.java   |  2 +-
 .../kie/client/ConfigKieHttpClientOptionsSPI.java  |  2 +-
 .../servicecomb/edge/core/EdgeInvocation.java      | 29 +++++++++++------
 foundations/foundation-registry/pom.xml            |  4 +++
 .../servicecomb/registry/DiscoveryManager.java     |  6 ++++
 .../servicecomb/registry/consumer/AppManager.java  |  7 ++++
 .../registry/consumer/MicroserviceManager.java     | 23 ++++++++++++-
 ...ecutor.java => SinglePoolBlockingExecutor.java} | 33 +++++++++++++++----
 ...rkerExecutor.java => VertxContextExecutor.java} | 23 +++++++++----
 .../schemadiscovery/SchemaDiscovery.java           |  4 ++-
 .../client/http/RegistryHttpClientOptionsSPI.java  |  2 +-
 .../http/RegistryWatchHttpClientOptionsSPI.java    |  4 +--
 .../config/ServiceRegistryConfig.java              |  2 --
 .../transport/highway/HighwayTransport.java        |  1 +
 .../client/Http2TransportHttpClientOptionsSPI.java |  5 +++
 .../client/HttpTransportHttpClientOptionsSPI.java  |  2 +-
 .../transport/rest/vertx/VertxRestTransport.java   |  3 ++
 32 files changed, 268 insertions(+), 80 deletions(-)
 rename demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/{Application.java => ClientApplication.java} (90%)
 copy demo/demo-zeroconfig-schemadiscovery-registry/{demo-zeroconfig-schemadiscovery-registry-client => demo-zeroconfig-schemadiscovery-registry-edge}/pom.xml (89%)
 copy demo/{demo-multi-registries/demo-multi-registries-server/src/main/java/org/apache/servicecomb/demo/registry/ServerApplication.java => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/EdgeApplication.java} (88%)
 copy demo/demo-zeroconfig-schemadiscovery-registry/{demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/server => demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge}/SelfServiceInvoker.java (93%)
 copy demo/{demo-multi-registries/demo-multi-registries-server/src/main/java/org/apache/servicecomb/demo/registry => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge}/ServerEndpoint.java (92%)
 copy demo/demo-zeroconfig-schemadiscovery-registry/{demo-zeroconfig-schemadiscovery-registry-client => demo-zeroconfig-schemadiscovery-registry-edge}/src/main/resources/application.yml (71%)
 copy demo/demo-zeroconfig-schemadiscovery-registry/{demo-zeroconfig-schemadiscovery-registry-tests => demo-zeroconfig-schemadiscovery-registry-edge}/src/main/resources/logback.xml (100%)
 copy inspector/src/test/resources/schema1.yaml => demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml (67%)
 copy foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/{VertxWorkerExecutor.java => SinglePoolBlockingExecutor.java} (54%)
 copy foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/{VertxWorkerExecutor.java => VertxContextExecutor.java} (69%)


[servicecomb-java-chassis] 06/06: [SCB-2000]make Completable future code more simpler

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 2c7aa7cbbbaba69388272b4805bb327b9f5602ae
Author: liubao <bi...@qq.com>
AuthorDate: Mon Jun 15 20:54:06 2020 +0800

    [SCB-2000]make Completable future code more simpler
---
 .../org/apache/servicecomb/core/SCBEngine.java     | 23 +++-------
 .../demo/zeroconfig/tests/ServerTest.java          |  1 +
 .../servicecomb/edge/core/EdgeInvocation.java      | 31 ++++++-------
 foundations/foundation-registry/pom.xml            |  4 ++
 .../registry/consumer/MicroserviceManager.java     | 22 +++------
 .../vertx/executor/SinglePoolBlockingExecutor.java | 53 ++++++++++++++++++++++
 .../vertx/executor/VertxContextExecutor.java       | 45 ++++++++++++++++++
 7 files changed, 130 insertions(+), 49 deletions(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index b62537a..ef764c0 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -508,22 +508,13 @@ public class SCBEngine {
    */
   public CompletableFuture<MicroserviceReferenceConfig> createMicroserviceReferenceConfigAsync(String microserviceName,
       String versionRule) {
-    CompletableFuture<MicroserviceReferenceConfig> result = new CompletableFuture<>();
-
-    CompletableFuture<MicroserviceVersions> microserviceVersions = DiscoveryManager.INSTANCE
-        .getOrCreateMicroserviceVersionsAsync(parseAppId(microserviceName), microserviceName);
-
-    microserviceVersions.whenComplete((r, e) -> {
-      if (e != null) {
-        result.completeExceptionally(e);
-      } else {
-        ConsumerMicroserviceVersionsMeta microserviceVersionsMeta = CoreMetaUtils
-            .getMicroserviceVersionsMeta(r);
-        result.complete(new MicroserviceReferenceConfig(microserviceVersionsMeta, versionRule));
-      }
-    });
-
-    return result;
+    return DiscoveryManager.INSTANCE
+        .getOrCreateMicroserviceVersionsAsync(parseAppId(microserviceName), microserviceName)
+        .thenApply(versions -> {
+          ConsumerMicroserviceVersionsMeta microserviceVersionsMeta = CoreMetaUtils
+              .getMicroserviceVersionsMeta(versions);
+          return new MicroserviceReferenceConfig(microserviceVersionsMeta, versionRule);
+        });
   }
 
   /**
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
index 23ab351..1d906f5 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
@@ -44,6 +44,7 @@ public class ServerTest implements CategorizedTestCase {
             "cse://demo-zeroconfig-schemadiscovery-registry-client/register/url/prefix/getName?name=world",
             String.class));
     // invoke demo-zeroconfig-schemadiscovery-registry-edge
+    // create many threads to test event-loop not blocking
     int thread = 32;
     CountDownLatch latch = new CountDownLatch(thread);
     for (int i = 0; i < thread; i++) {
diff --git a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
index 445522f..9c502fb 100644
--- a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
+++ b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
@@ -30,10 +30,10 @@ import org.apache.servicecomb.core.invocation.InvocationFactory;
 import org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig;
 import org.apache.servicecomb.core.provider.consumer.ReactiveResponseExecutor;
 import org.apache.servicecomb.core.provider.consumer.ReferenceConfig;
+import org.apache.servicecomb.foundation.vertx.executor.VertxContextExecutor;
 import org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest;
 import org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse;
 
-import io.vertx.core.Context;
 import io.vertx.core.Vertx;
 import io.vertx.ext.web.RoutingContext;
 
@@ -61,24 +61,19 @@ public class EdgeInvocation extends AbstractRestInvocation {
   }
 
   public void edgeInvoke() {
-    Context currentContext = Vertx.currentContext();
-    findMicroserviceVersionMeta().whenComplete((r, e) -> {
-          // get back to the context so that registered handlers can work properly
-          currentContext.runOnContext((event) -> {
-            if (e != null) {
-              sendFailResponse(e);
-            } else {
-              try {
-                microserviceReferenceConfig = r;
-                findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
-                scheduleInvocation();
-              } catch (Throwable error) {
-                sendFailResponse(error);
-              }
-            }
-          });
+    findMicroserviceVersionMeta().whenCompleteAsync((r, e) -> {
+      if (e != null) {
+        sendFailResponse(e);
+      } else {
+        try {
+          microserviceReferenceConfig = r;
+          findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
+          scheduleInvocation();
+        } catch (Throwable error) {
+          sendFailResponse(error);
         }
-    );
+      }
+    }, VertxContextExecutor.create(Vertx.currentContext()));
   }
 
   protected CompletableFuture<MicroserviceReferenceConfig> findMicroserviceVersionMeta() {
diff --git a/foundations/foundation-registry/pom.xml b/foundations/foundation-registry/pom.xml
index 044545d..5e6b939 100644
--- a/foundations/foundation-registry/pom.xml
+++ b/foundations/foundation-registry/pom.xml
@@ -37,6 +37,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-vertx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
       <artifactId>swagger-invocation-core</artifactId>
     </dependency>
     <dependency>
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
index 0c6482a..432cae7 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.apache.servicecomb.foundation.vertx.executor.SinglePoolBlockingExecutor;
 import org.apache.servicecomb.registry.api.event.MicroserviceInstanceChangedEvent;
 import org.apache.servicecomb.registry.api.event.task.SafeModeChangeEvent;
 import org.slf4j.Logger;
@@ -72,30 +73,21 @@ public class MicroserviceManager {
   }
 
   public CompletableFuture<MicroserviceVersions> getOrCreateMicroserviceVersionsAsync(String microserviceName) {
-    CompletableFuture<MicroserviceVersions> result = new CompletableFuture<>();
     MicroserviceVersions microserviceVersions = versionsByName.get(microserviceName);
     if (microserviceVersions == null) {
       if (Vertx.currentContext() == null) {
         // not in event-loop, execute in current thread
-        result.complete(getOrCreateMicroserviceVersions(microserviceName));
+        return CompletableFuture.completedFuture(getOrCreateMicroserviceVersions(microserviceName));
       } else {
-        // executing blocking code in event-loop
-        Vertx.currentContext().<MicroserviceVersions>executeBlocking(blockingCodeHandler -> {
-          blockingCodeHandler.complete(getOrCreateMicroserviceVersions(microserviceName));
-        }, r -> {
-          if (r.failed()) {
-            result.completeExceptionally(r.cause());
-          } else {
-            result.complete(r.result());
-          }
-        });
+        // execute in an single thread pool to make sure make less requests to service center
+        return CompletableFuture.supplyAsync(() -> getOrCreateMicroserviceVersions(microserviceName),
+            SinglePoolBlockingExecutor.create());
       }
     } else {
-      result.complete(microserviceVersions);
+      // here do not need switch to another thread, can improve performance
       tryRemoveInvalidMicroservice(microserviceVersions);
+      return CompletableFuture.completedFuture(microserviceVersions);
     }
-
-    return result;
   }
 
   private void tryRemoveInvalidMicroservice(MicroserviceVersions microserviceVersions) {
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/SinglePoolBlockingExecutor.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/SinglePoolBlockingExecutor.java
new file mode 100644
index 0000000..176e66a
--- /dev/null
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/SinglePoolBlockingExecutor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.vertx.executor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SinglePoolBlockingExecutor implements Executor {
+  private static final Logger LOGGER = LoggerFactory.getLogger(SinglePoolBlockingExecutor.class);
+
+  private static final Executor SINGLE_POOL = Executors.newSingleThreadExecutor((r) -> {
+    Thread thread = new Thread(r);
+    thread.setName("single-pool-blocking-executor");
+    return thread;
+  });
+
+  public static SinglePoolBlockingExecutor create() {
+    return new SinglePoolBlockingExecutor();
+  }
+
+  private SinglePoolBlockingExecutor() {
+
+  }
+
+  @Override
+  public void execute(Runnable command) {
+    SINGLE_POOL.execute(() -> {
+      try {
+        command.run();
+      } catch (Throwable e) {
+        LOGGER.error("Logic should not throw exception, please fix it", e);
+      }
+    });
+  }
+}
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxContextExecutor.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxContextExecutor.java
new file mode 100644
index 0000000..a7157ba
--- /dev/null
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxContextExecutor.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.vertx.executor;
+
+import java.util.concurrent.Executor;
+
+import io.vertx.core.Context;
+import io.vertx.core.Vertx;
+
+public class VertxContextExecutor implements Executor {
+  public static VertxContextExecutor create(Context context) {
+    return new VertxContextExecutor(context);
+  }
+
+  private Context context;
+
+  private VertxContextExecutor(Context context) {
+    this.context = context;
+  }
+
+  @Override
+  public void execute(Runnable command) {
+    if (context == Vertx.currentContext()) {
+      command.run();
+      return;
+    }
+
+    context.runOnContext(v -> command.run());
+  }
+}


[servicecomb-java-chassis] 03/06: [SCB-2000]need catch exception and on failure not processing it

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 86325a3a3d1bd931184768bedbd435b83ef30d7c
Author: liubao <bi...@qq.com>
AuthorDate: Sat Jun 13 16:13:07 2020 +0800

    [SCB-2000]need catch exception and on failure not processing it
---
 .../java/org/apache/servicecomb/edge/core/EdgeInvocation.java  | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
index 962c72e..445522f 100644
--- a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
+++ b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
@@ -68,9 +68,13 @@ public class EdgeInvocation extends AbstractRestInvocation {
             if (e != null) {
               sendFailResponse(e);
             } else {
-              microserviceReferenceConfig = r;
-              findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
-              scheduleInvocation();
+              try {
+                microserviceReferenceConfig = r;
+                findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
+                scheduleInvocation();
+              } catch (Throwable error) {
+                sendFailResponse(error);
+              }
             }
           });
         }


[servicecomb-java-chassis] 05/06: [SCB-2000]add license to file

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit e62d35c83a6c3525bc67bb154d11895966390545
Author: liubao <bi...@qq.com>
AuthorDate: Sat Jun 13 16:57:41 2020 +0800

    [SCB-2000]add license to file
---
 .../ClientServerEndpoint.yaml                          | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml
index 9061817..3243bbd 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml
@@ -1,4 +1,20 @@
----
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 swagger: "2.0"
 info:
   version: "1.0.0"


[servicecomb-java-chassis] 02/06: [SCB-2000]add edge docker image and set work pool name

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 331471ed693df4c56b739370c5395f9b8251840c
Author: liubao <bi...@qq.com>
AuthorDate: Sat Jun 13 12:00:05 2020 +0800

    [SCB-2000]add edge docker image and set work pool name
---
 .../pom.xml                                        | 23 ++++++++++++++++++++++
 .../client/ConfigCenterHttpClientOptionsSPI.java   |  2 +-
 .../kie/client/ConfigKieHttpClientOptionsSPI.java  |  2 +-
 .../client/http/RegistryHttpClientOptionsSPI.java  |  2 +-
 .../http/RegistryWatchHttpClientOptionsSPI.java    |  4 ++--
 .../config/ServiceRegistryConfig.java              |  2 --
 .../client/Http2TransportHttpClientOptionsSPI.java |  2 +-
 .../client/HttpTransportHttpClientOptionsSPI.java  |  7 ++++---
 .../transport/rest/vertx/VertxRestTransport.java   |  7 +++----
 9 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
index 0fb56ae..0d772b4 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
@@ -102,6 +102,29 @@
                       </ports>
                     </run>
                   </image>
+
+                  <image>
+                    <name>demo-zeroconfig-schemadiscovery-registry-edge:${project.version}</name>
+                    <alias>demo-zeroconfig-schemadiscovery-registry-edge</alias>
+                    <run>
+                      <env>
+                        <JAR_PATH>/maven/maven/demo-zeroconfig-schemadiscovery-registry-edge-${project.version}.jar
+                        </JAR_PATH>
+                      </env>
+                      <wait>
+                        <log>Service information is shown below</log>
+                        <tcp>
+                          <ports>
+                            <port>8888</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>8888:8888</port>
+                      </ports>
+                    </run>
+                  </image>
                 </images>
               </configuration>
               <executions>
diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterHttpClientOptionsSPI.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterHttpClientOptionsSPI.java
index 15a2400..5a6feda 100644
--- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterHttpClientOptionsSPI.java
+++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterHttpClientOptionsSPI.java
@@ -77,7 +77,7 @@ public class ConfigCenterHttpClientOptionsSPI implements HttpClientOptionsSPI {
 
   @Override
   public String getWorkerPoolName() {
-    return null;
+    return "pool-worker-config-center-client";
   }
 
   @Override
diff --git a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/ConfigKieHttpClientOptionsSPI.java b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/ConfigKieHttpClientOptionsSPI.java
index 6921a56..7b46738 100644
--- a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/ConfigKieHttpClientOptionsSPI.java
+++ b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/ConfigKieHttpClientOptionsSPI.java
@@ -75,7 +75,7 @@ public class ConfigKieHttpClientOptionsSPI implements HttpClientOptionsSPI {
 
   @Override
   public String getWorkerPoolName() {
-    return null;
+    return "pool-worker-kie-client";
   }
 
   @Override
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryHttpClientOptionsSPI.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryHttpClientOptionsSPI.java
index b465252..5f15321 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryHttpClientOptionsSPI.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryHttpClientOptionsSPI.java
@@ -80,7 +80,7 @@ public class RegistryHttpClientOptionsSPI implements HttpClientOptionsSPI {
 
   @Override
   public String getWorkerPoolName() {
-    return null;
+    return "pool-worker-service-center-client";
   }
 
   @Override
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryWatchHttpClientOptionsSPI.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryWatchHttpClientOptionsSPI.java
index 049de98..95059ab 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryWatchHttpClientOptionsSPI.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/http/RegistryWatchHttpClientOptionsSPI.java
@@ -50,13 +50,13 @@ public class RegistryWatchHttpClientOptionsSPI extends RegistryHttpClientOptions
 
   @Override
   public String getWorkerPoolName() {
-    return ServiceRegistryConfig.WORKER_POOL_NAME;
+    return "pool-worker-service-center-watch";
   }
 
   @Override
   public int getWorkerPoolSize() {
     return DynamicPropertyFactory.getInstance()
-        .getIntProperty(ServiceRegistryConfig.WORKER_POOL_SIZE, 4).get();
+        .getIntProperty(ServiceRegistryConfig.WORKER_POOL_SIZE, 2).get();
   }
 
   @Override
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
index bfc1009..4afe149 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
@@ -70,8 +70,6 @@ public class ServiceRegistryConfig {
 
   public static final String WORKER_POOL_SIZE = "servicecomb.service.registry.client.workerPoolSize";
 
-  public static final String WORKER_POOL_NAME = "registry-vert.x-worker-thread";
-
   private String registryName = ServiceRegistry.DEFAULT_REGISTRY_NAME;
 
   private HttpVersion httpVersion;
diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
index 24bbd5b..ad0b3bb 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
@@ -44,7 +44,7 @@ public class Http2TransportHttpClientOptionsSPI extends HttpTransportHttpClientO
 
   @Override
   public String getWorkerPoolName() {
-    return "pool-transport-client-http2";
+    return "pool-worker-transport-client-http2";
   }
 
   @Override
diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
index b449520..e3a0e02 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
@@ -21,6 +21,7 @@ import org.apache.servicecomb.foundation.vertx.client.http.HttpClientOptionsSPI;
 
 import com.netflix.config.ConcurrentCompositeConfiguration;
 
+import io.vertx.core.VertxOptions;
 import io.vertx.core.http.HttpClientOptions;
 import io.vertx.core.http.HttpVersion;
 
@@ -72,17 +73,17 @@ public class HttpTransportHttpClientOptionsSPI implements HttpClientOptionsSPI {
 
   @Override
   public boolean isWorker() {
-    return true;
+    return false;
   }
 
   @Override
   public String getWorkerPoolName() {
-    return "pool-transport-client-http";
+    return "pool-worker-transport-client-http";
   }
 
   @Override
   public int getWorkerPoolSize() {
-    return 2;
+    return VertxOptions.DEFAULT_WORKER_POOL_SIZE;
   }
 
   @Override
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
index 626df93..7e5aeb4 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import io.vertx.core.DeploymentOptions;
+import io.vertx.core.VertxOptions;
 
 public class VertxRestTransport extends AbstractTransport {
   private static final Logger LOGGER = LoggerFactory.getLogger(VertxRestTransport.class);
@@ -76,10 +77,8 @@ public class VertxRestTransport extends AbstractTransport {
     json.put(ENDPOINT_KEY, getEndpoint());
     json.put(RestTransportClient.class.getName(), restClient);
     options.setConfig(json);
-    // now used not very frequently, hard code its options
-    options.setWorker(true);
-    options.setWorkerPoolName("pool-transport");
-    options.setWorkerPoolSize(2);
+    options.setWorkerPoolName("pool-worker-transport");
+    options.setWorkerPoolSize(VertxOptions.DEFAULT_WORKER_POOL_SIZE);
     return VertxUtils.blockDeploy(transportVertx, TransportConfig.getRestServerVerticle(), options);
   }
 


[servicecomb-java-chassis] 04/06: [SCB-2000]give a name to easy analyses stack

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 7f7baf9b374c9b3e7fbb85fa960372e066623ea1
Author: liubao <bi...@qq.com>
AuthorDate: Sat Jun 13 16:37:44 2020 +0800

    [SCB-2000]give a name to easy analyses stack
---
 .../java/org/apache/servicecomb/transport/highway/HighwayTransport.java | 1 +
 .../org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayTransport.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayTransport.java
index 1a61bec..3011572 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayTransport.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayTransport.java
@@ -45,6 +45,7 @@ public class HighwayTransport extends AbstractTransport {
     SimpleJsonObject json = new SimpleJsonObject();
     json.put(ENDPOINT_KEY, getEndpoint());
     deployOptions.setConfig(json);
+    deployOptions.setWorkerPoolName("pool-worker-transport-highway");
     return VertxUtils.blockDeploy(transportVertx, HighwayServerVerticle.class, deployOptions);
   }
 
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
index 7e5aeb4..c7dd784 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
@@ -77,7 +77,7 @@ public class VertxRestTransport extends AbstractTransport {
     json.put(ENDPOINT_KEY, getEndpoint());
     json.put(RestTransportClient.class.getName(), restClient);
     options.setConfig(json);
-    options.setWorkerPoolName("pool-worker-transport");
+    options.setWorkerPoolName("pool-worker-transport-rest");
     options.setWorkerPoolSize(VertxOptions.DEFAULT_WORKER_POOL_SIZE);
     return VertxUtils.blockDeploy(transportVertx, TransportConfig.getRestServerVerticle(), options);
   }


[servicecomb-java-chassis] 01/06: [SCB-2000]schema discovery working in edge service

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit ba6db7694af98089e19e86d66f1cd7ea9d6b9c1f
Author: liubao <bi...@qq.com>
AuthorDate: Fri Jun 12 18:05:07 2020 +0800

    [SCB-2000]schema discovery working in edge service
---
 .../org/apache/servicecomb/core/SCBEngine.java     | 27 ++++++++++++
 .../README.md                                      |  6 ++-
 .../pom.xml                                        |  2 +-
 .../{Application.java => ClientApplication.java}   |  4 +-
 .../pom.xml                                        | 14 +++---
 .../demo/zeroconfig/edge/EdgeApplication.java}     | 21 ++++++---
 .../demo/zeroconfig/edge/SelfServiceInvoker.java}  | 31 +++++++++-----
 .../demo/zeroconfig/edge/ServerEndpoint.java       | 41 ++++++++++++++++++
 .../src/main/resources/application.yml}            | 40 ++++++++++++-----
 .../src/main/resources/logback.xml                 | 50 ++++++++++++++++++++++
 .../pom.xml                                        |  4 --
 .../demo/zeroconfig/tests/ServerTest.java          | 37 +++++++++++++---
 .../ClientServerEndpoint.yaml                      | 39 +++++++++++++++++
 .../src/main/resources/registry.yaml               | 12 +++++-
 .../pom.xml                                        |  5 +--
 .../servicecomb/edge/core/EdgeInvocation.java      | 30 ++++++++-----
 .../servicecomb/registry/DiscoveryManager.java     |  6 +++
 .../servicecomb/registry/consumer/AppManager.java  |  7 +++
 .../registry/consumer/MicroserviceManager.java     | 31 +++++++++++++-
 .../schemadiscovery/SchemaDiscovery.java           |  4 +-
 .../client/Http2TransportHttpClientOptionsSPI.java |  5 +++
 .../client/HttpTransportHttpClientOptionsSPI.java  |  7 ++-
 .../transport/rest/vertx/VertxRestTransport.java   |  4 ++
 23 files changed, 362 insertions(+), 65 deletions(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index feea662..b62537a 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicLong;
@@ -505,6 +506,32 @@ public class SCBEngine {
    * @param versionRule if is empty, then use configuration value
    * @return
    */
+  public CompletableFuture<MicroserviceReferenceConfig> createMicroserviceReferenceConfigAsync(String microserviceName,
+      String versionRule) {
+    CompletableFuture<MicroserviceReferenceConfig> result = new CompletableFuture<>();
+
+    CompletableFuture<MicroserviceVersions> microserviceVersions = DiscoveryManager.INSTANCE
+        .getOrCreateMicroserviceVersionsAsync(parseAppId(microserviceName), microserviceName);
+
+    microserviceVersions.whenComplete((r, e) -> {
+      if (e != null) {
+        result.completeExceptionally(e);
+      } else {
+        ConsumerMicroserviceVersionsMeta microserviceVersionsMeta = CoreMetaUtils
+            .getMicroserviceVersionsMeta(r);
+        result.complete(new MicroserviceReferenceConfig(microserviceVersionsMeta, versionRule));
+      }
+    });
+
+    return result;
+  }
+
+  /**
+   * for edge, versionRule maybe controlled by url rule
+   * @param microserviceName hortName, or appId:shortName when invoke cross app
+   * @param versionRule if is empty, then use configuration value
+   * @return
+   */
   public MicroserviceReferenceConfig createMicroserviceReferenceConfig(String microserviceName, String versionRule) {
     MicroserviceVersions microserviceVersions = DiscoveryManager.INSTANCE
         .getOrCreateMicroserviceVersions(parseAppId(microserviceName), microserviceName);
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/README.md b/demo/demo-zeroconfig-schemadiscovery-registry/README.md
index 34c4da9..44cd553 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/README.md
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/README.md
@@ -10,8 +10,12 @@ This demo tests zeroconfig.
 
   run in docker, and find server instances through zeroconfig, find schemas through
   schema discovery
+
+* edge
+  run in docker, and find server instances through zeroconfig, find schemas through
+  schema discovery
   
 * tests
 
-  integration tests run in host machine, find client instances through local, 
+  integration tests run in host machine, find client/edge instances through local, 
   and schemas from schema discovery. 
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
index f49aaba..a25bd68 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
@@ -29,7 +29,7 @@
   </parent>
 
   <properties>
-    <demo.main>org.apache.servicecomb.demo.zeroconfig.client.Application</demo.main>
+    <demo.main>org.apache.servicecomb.demo.zeroconfig.client.ClientApplication</demo.main>
   </properties>
   <dependencies>
     <dependency>
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientApplication.java
similarity index 90%
copy from demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
copy to demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientApplication.java
index f2ed3c8..3206cb9 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientApplication.java
@@ -24,10 +24,10 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
 
 @SpringBootApplication
 @EnableServiceComb
-public class Application {
+public class ClientApplication {
 
   public static void main(final String[] args) throws Exception {
-    new SpringApplicationBuilder().sources(Application.class).web(WebApplicationType.SERVLET)
+    new SpringApplicationBuilder().sources(ClientApplication.class).web(WebApplicationType.SERVLET)
         .build().run(args);
   }
 }
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/pom.xml
similarity index 89%
copy from demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
copy to demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/pom.xml
index f49aaba..4b6a12f 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/pom.xml
@@ -20,8 +20,8 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
   xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>demo-zeroconfig-schemadiscovery-registry-client</artifactId>
-  <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Client</name>
+  <artifactId>demo-zeroconfig-schemadiscovery-registry-edge</artifactId>
+  <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Edge</name>
   <parent>
     <groupId>org.apache.servicecomb.demo</groupId>
     <artifactId>demo-zeroconfig-schemadiscovery-registry</artifactId>
@@ -29,7 +29,7 @@
   </parent>
 
   <properties>
-    <demo.main>org.apache.servicecomb.demo.zeroconfig.client.Application</demo.main>
+    <demo.main>org.apache.servicecomb.demo.zeroconfig.edge.EdgeApplication</demo.main>
   </properties>
   <dependencies>
     <dependency>
@@ -38,7 +38,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
+      <artifactId>edge-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
@@ -93,4 +97,4 @@
       </build>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/EdgeApplication.java
similarity index 66%
copy from demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
copy to demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/EdgeApplication.java
index f2ed3c8..91685d0 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/EdgeApplication.java
@@ -15,8 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo.zeroconfig.client;
+package org.apache.servicecomb.demo.zeroconfig.edge;
 
+import java.util.concurrent.TimeUnit;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
 import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -24,10 +28,17 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
 
 @SpringBootApplication
 @EnableServiceComb
-public class Application {
-
+public class EdgeApplication {
   public static void main(final String[] args) throws Exception {
-    new SpringApplicationBuilder().sources(Application.class).web(WebApplicationType.SERVLET)
-        .build().run(args);
+    new SpringApplicationBuilder().sources(EdgeApplication.class).web(WebApplicationType.NONE).build().run(args);
+
+    SelfServiceInvoker invoker = BeanUtils.getBean("SelfServiceInvoker");
+    invoker.latch.await(10, TimeUnit.SECONDS);
+    TestMgr.check(invoker.result, "hello");
+
+    TestMgr.summary();
+    if (!TestMgr.errors().isEmpty()) {
+      System.exit(1);
+    }
   }
 }
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/SelfServiceInvoker.java
similarity index 51%
rename from demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
rename to demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/SelfServiceInvoker.java
index f2ed3c8..e653524 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/Application.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/SelfServiceInvoker.java
@@ -15,19 +15,28 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo.zeroconfig.client;
+package org.apache.servicecomb.demo.zeroconfig.edge;
 
-import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
-import org.springframework.boot.WebApplicationType;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
+import java.util.concurrent.CountDownLatch;
+import org.apache.servicecomb.core.BootListener;
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
 
-@SpringBootApplication
-@EnableServiceComb
-public class Application {
+@Component("SelfServiceInvoker")
+public class SelfServiceInvoker implements BootListener {
+  interface IServerEndpoint {
+    String getName(String name);
+  }
+
+  @RpcReference(microserviceName = "demo-zeroconfig-schemadiscovery-registry-edge", schemaId = "ServerEndpoint")
+  IServerEndpoint endpoint;
+
+  public CountDownLatch latch = new CountDownLatch(1);
+
+  public String result = "";
 
-  public static void main(final String[] args) throws Exception {
-    new SpringApplicationBuilder().sources(Application.class).web(WebApplicationType.SERVLET)
-        .build().run(args);
+  public void onAfterRegistry(BootEvent event) {
+    result = endpoint.getName("hello");
+    latch.countDown();
   }
 }
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/ServerEndpoint.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/ServerEndpoint.java
new file mode 100644
index 0000000..24e25ed
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/java/org/apache/servicecomb/demo/zeroconfig/edge/ServerEndpoint.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.demo.zeroconfig.edge;
+
+import javax.ws.rs.core.MediaType;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "ServerEndpoint")
+@RequestMapping(path = "/edge/prefix", produces = MediaType.APPLICATION_JSON)
+public class ServerEndpoint {
+  private static final Logger LOGGER
+      = LoggerFactory.getLogger(ServerEndpoint.class);
+
+  @GetMapping(path = "/getName")
+  public String getName(@RequestParam(name = "name") String name) {
+    ((Invocation) ContextUtils.getInvocationContext()).getTraceIdLogger().info(LOGGER, "get name invoked.");
+    return name;
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/application.yml
similarity index 58%
copy from demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml
copy to demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/application.yml
index 2dc9fa4..5062701 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/application.yml
@@ -15,13 +15,33 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-demo-zeroconfig-schemadiscovery-registry-client:
-  - id: "001"
-    version: "0.0.2"
-    appid: demo-zeroconfig-schemadiscovery-registry
-    schemaIds:
-      - ClientServerEndpoint
-      - SchemaDiscoveryEndpoint
-    instances:
-      - endpoints:
-          - rest://localhost:8082
\ No newline at end of file
+server:
+  port: 8888
+
+# java-chassis configurations
+
+APPLICATION_ID: demo-zeroconfig-schemadiscovery-registry
+service_description:
+  name: demo-zeroconfig-schemadiscovery-registry-edge
+  version: 0.0.2
+servicecomb:
+  rest:
+    address: 0.0.0.0:8888
+  handler:
+    chain:
+      Consumer:
+        default: loadbalance
+  http:
+    dispatcher:
+      edge:
+        default:
+          enabled: false
+        url:
+          enabled: true
+          pattern: /(.*)
+          mappings:
+            client:
+              prefixSegmentCount: 0
+              path: "/register/url/prefix/.*"
+              microserviceName: demo-zeroconfig-schemadiscovery-registry-client
+              versionRule: 0+
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/logback.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/logback.xml
new file mode 100644
index 0000000..0d627f2
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-edge/src/main/resources/logback.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<configuration scan="true">
+  <appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>DENY</OnMismatch>
+      <OnMatch>ACCEPT</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>ACCEPT</OnMismatch>
+      <OnMatch>DENY</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT"/>
+    <appender-ref ref="STDOUT-TRACING"/>
+  </root>
+</configuration>
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
index 08a0b5f..0fb56ae 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/pom.xml
@@ -41,10 +41,6 @@
       <artifactId>registry-schema-discovery</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.servicecomb</groupId>
-      <artifactId>registry-zero-config</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.servicecomb.demo</groupId>
       <artifactId>demo-schema</artifactId>
     </dependency>
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
index b77e009..23ab351 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
@@ -18,6 +18,7 @@
 package org.apache.servicecomb.demo.zeroconfig.tests;
 
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
 
 import org.apache.servicecomb.demo.CategorizedTestCase;
 import org.apache.servicecomb.demo.TestMgr;
@@ -31,26 +32,52 @@ public class ServerTest implements CategorizedTestCase {
   RestTemplate template = RestTemplateBuilder.create();
 
   @Override
-  public void testRestTransport() {
+  public void testRestTransport() throws Exception {
     testServerGetName();
     testGetAllMicroservice();
   }
 
-  private void testGetAllMicroservice() {
+  private void testServerGetName() throws Exception {
     // invoke demo-zeroconfig-schemadiscovery-registry-client
-    TestMgr.check("2", template
+    TestMgr.check("world", template
         .getForObject(
-            "cse://demo-zeroconfig-schemadiscovery-registry-client/register/url/prefix/getName?name=2",
+            "cse://demo-zeroconfig-schemadiscovery-registry-client/register/url/prefix/getName?name=world",
             String.class));
+    // invoke demo-zeroconfig-schemadiscovery-registry-edge
+    int thread = 32;
+    CountDownLatch latch = new CountDownLatch(thread);
+    for (int i = 0; i < thread; i++) {
+      new Thread(() -> {
+        for (int j = 0; j < 20; j++) {
+          try {
+            TestMgr.check("world", template
+                .getForObject(
+                    "cse://demo-zeroconfig-schemadiscovery-registry-edge/register/url/prefix/getName?name=world",
+                    String.class));
+          } catch (Exception e) {
+            TestMgr.failed("test failed", e);
+          }
+        }
+        latch.countDown();
+      }).start();
+    }
+
+    latch.await();
   }
 
   @SuppressWarnings("rawTypes")
-  private void testServerGetName() {
+  private void testGetAllMicroservice() {
     // invoke demo-zeroconfig-schemadiscovery-registry-client
     TestMgr.check("2", template
         .getForObject(
             "cse://demo-zeroconfig-schemadiscovery-registry-client"
                 + "/register/url/prefix/getRegisteredMicroservice",
             List.class).size());
+    // invoke demo-zeroconfig-schemadiscovery-registry-edge
+    TestMgr.check("2", template
+        .getForObject(
+            "cse://demo-zeroconfig-schemadiscovery-registry-edge"
+                + "/register/url/prefix/getRegisteredMicroservice",
+            List.class).size());
   }
 }
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml
new file mode 100644
index 0000000..9061817
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/microservices/demo-zeroconfig-schemadiscovery-registry-edge/ClientServerEndpoint.yaml
@@ -0,0 +1,39 @@
+---
+swagger: "2.0"
+info:
+  version: "1.0.0"
+  title: "swagger definition for org.apache.servicecomb.demo.zeroconfig.client.ClientServerEndpoint"
+  x-java-interface: "gen.swagger.ClientServerEndpointIntf"
+basePath: "/register/url/prefix"
+schemes:
+  - "http"
+consumes:
+  - "application/json"
+produces:
+  - "application/json"
+paths:
+  /getName:
+    get:
+      operationId: "getName"
+      parameters:
+        - name: "name"
+          in: "query"
+          required: true
+          type: "string"
+      responses:
+        "200":
+          description: "response of 200"
+          schema:
+            type: "string"
+  /getRegisteredMicroservice:
+    get:
+      operationId: "getRegisteredMicroservice"
+      parameters: []
+      responses:
+        "200":
+          description: "response of 200"
+          schema:
+            type: "array"
+            items:
+              type: "string"
+            uniqueItems: true
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml
index 2dc9fa4..df728fc 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/resources/registry.yaml
@@ -24,4 +24,14 @@ demo-zeroconfig-schemadiscovery-registry-client:
       - SchemaDiscoveryEndpoint
     instances:
       - endpoints:
-          - rest://localhost:8082
\ No newline at end of file
+          - rest://localhost:8082
+demo-zeroconfig-schemadiscovery-registry-edge:
+  - id: "002"
+    version: "0.0.2"
+    appid: demo-zeroconfig-schemadiscovery-registry
+    schemaIds:
+      - ClientServerEndpoint
+      - SchemaDiscoveryEndpoint
+    instances:
+      - endpoints:
+          - rest://localhost:8888
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
index 7c9e2b4..83be7f0 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
@@ -29,6 +29,7 @@
   <packaging>pom</packaging>
   <modules>
     <module>demo-zeroconfig-schemadiscovery-registry-server</module>
+    <module>demo-zeroconfig-schemadiscovery-registry-edge</module>
     <module>demo-zeroconfig-schemadiscovery-registry-client</module>
     <module>demo-zeroconfig-schemadiscovery-registry-tests</module>
   </modules>
@@ -36,10 +37,6 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-test-scaffolding</artifactId>
       <scope>compile</scope>
     </dependency>
diff --git a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
index b0a6f32..962c72e 100644
--- a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
+++ b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeInvocation.java
@@ -18,6 +18,7 @@
 package org.apache.servicecomb.edge.core;
 
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 
 import org.apache.servicecomb.common.rest.AbstractRestInvocation;
 import org.apache.servicecomb.common.rest.RestConst;
@@ -32,6 +33,7 @@ import org.apache.servicecomb.core.provider.consumer.ReferenceConfig;
 import org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest;
 import org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse;
 
+import io.vertx.core.Context;
 import io.vertx.core.Vertx;
 import io.vertx.ext.web.RoutingContext;
 
@@ -59,17 +61,25 @@ public class EdgeInvocation extends AbstractRestInvocation {
   }
 
   public void edgeInvoke() {
-    findMicroserviceVersionMeta();
-    findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
-
-    scheduleInvocation();
+    Context currentContext = Vertx.currentContext();
+    findMicroserviceVersionMeta().whenComplete((r, e) -> {
+          // get back to the context so that registered handlers can work properly
+          currentContext.runOnContext((event) -> {
+            if (e != null) {
+              sendFailResponse(e);
+            } else {
+              microserviceReferenceConfig = r;
+              findRestOperation(microserviceReferenceConfig.getLatestMicroserviceMeta());
+              scheduleInvocation();
+            }
+          });
+        }
+    );
   }
 
-  protected void findMicroserviceVersionMeta() {
-    // if not present, should use configured value
-    String versionRule = chooseVersionRule();
-    microserviceReferenceConfig = SCBEngine.getInstance()
-        .createMicroserviceReferenceConfig(microserviceName, versionRule);
+  protected CompletableFuture<MicroserviceReferenceConfig> findMicroserviceVersionMeta() {
+    return SCBEngine.getInstance()
+        .createMicroserviceReferenceConfigAsync(microserviceName, chooseVersionRule());
   }
 
   public void setVersionRule(String versionRule) {
@@ -83,7 +93,7 @@ public class EdgeInvocation extends AbstractRestInvocation {
   //   v1->1.0.0-2.0.0
   //   v2->2.0.0-3.0.0
   // that means if a(1.x.x) bigger then b(1.y.y), then a compatible to b
-  //        but a(2.x.x) not compatible to b   
+  //        but a(2.x.x) not compatible to b
   protected String chooseVersionRule() {
     // this will use all instance of the microservice
     // and this required all new version compatible to old version
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java
index ab0c6f7..8ce351f 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java
@@ -20,6 +20,7 @@ package org.apache.servicecomb.registry;
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 import org.apache.servicecomb.config.ConfigUtil;
@@ -130,6 +131,11 @@ public class DiscoveryManager {
     return result;
   }
 
+  public CompletableFuture<MicroserviceVersions> getOrCreateMicroserviceVersionsAsync(String appId,
+      String microserviceName) {
+    return appManager.getOrCreateMicroserviceVersionsAsync(appId, microserviceName);
+  }
+
   public MicroserviceVersions getOrCreateMicroserviceVersions(String appId, String microserviceName) {
     return appManager.getOrCreateMicroserviceVersions(appId, microserviceName);
   }
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/AppManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/AppManager.java
index cfa3f09..0dd13cd 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/AppManager.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/AppManager.java
@@ -18,6 +18,7 @@
 package org.apache.servicecomb.registry.consumer;
 
 import java.util.Map;
+import java.util.concurrent.CompletableFuture;
 
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
 import org.apache.servicecomb.foundation.common.event.EventManager;
@@ -54,6 +55,12 @@ public class AppManager {
     return apps.computeIfAbsent(appId, id -> new MicroserviceManager(this, appId));
   }
 
+  public CompletableFuture<MicroserviceVersions> getOrCreateMicroserviceVersionsAsync(String appId
+      , String microserviceName) {
+    MicroserviceManager microserviceManager = getOrCreateMicroserviceManager(appId);
+    return microserviceManager.getOrCreateMicroserviceVersionsAsync(microserviceName);
+  }
+
   public MicroserviceVersions getOrCreateMicroserviceVersions(String appId, String microserviceName) {
     MicroserviceManager microserviceManager = getOrCreateMicroserviceManager(appId);
     return microserviceManager.getOrCreateMicroserviceVersions(microserviceName);
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
index 4fb414e..0c6482a 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/MicroserviceManager.java
@@ -17,8 +17,8 @@
 
 package org.apache.servicecomb.registry.consumer;
 
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.CompletableFuture;
 
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
 import org.apache.servicecomb.registry.api.event.MicroserviceInstanceChangedEvent;
@@ -26,6 +26,8 @@ import org.apache.servicecomb.registry.api.event.task.SafeModeChangeEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import io.vertx.core.Vertx;
+
 public class MicroserviceManager {
   private static final Logger LOGGER = LoggerFactory.getLogger(MicroserviceManager.class);
 
@@ -69,6 +71,33 @@ public class MicroserviceManager {
     return microserviceVersions;
   }
 
+  public CompletableFuture<MicroserviceVersions> getOrCreateMicroserviceVersionsAsync(String microserviceName) {
+    CompletableFuture<MicroserviceVersions> result = new CompletableFuture<>();
+    MicroserviceVersions microserviceVersions = versionsByName.get(microserviceName);
+    if (microserviceVersions == null) {
+      if (Vertx.currentContext() == null) {
+        // not in event-loop, execute in current thread
+        result.complete(getOrCreateMicroserviceVersions(microserviceName));
+      } else {
+        // executing blocking code in event-loop
+        Vertx.currentContext().<MicroserviceVersions>executeBlocking(blockingCodeHandler -> {
+          blockingCodeHandler.complete(getOrCreateMicroserviceVersions(microserviceName));
+        }, r -> {
+          if (r.failed()) {
+            result.completeExceptionally(r.cause());
+          } else {
+            result.complete(r.result());
+          }
+        });
+      }
+    } else {
+      result.complete(microserviceVersions);
+      tryRemoveInvalidMicroservice(microserviceVersions);
+    }
+
+    return result;
+  }
+
   private void tryRemoveInvalidMicroservice(MicroserviceVersions microserviceVersions) {
     if (!microserviceVersions.isWaitingDelete()) {
       return;
diff --git a/service-registry/registry-schema-discovery/src/main/java/org/apache/servicecomb/schemadiscovery/SchemaDiscovery.java b/service-registry/registry-schema-discovery/src/main/java/org/apache/servicecomb/schemadiscovery/SchemaDiscovery.java
index fd4cf00..772942a 100644
--- a/service-registry/registry-schema-discovery/src/main/java/org/apache/servicecomb/schemadiscovery/SchemaDiscovery.java
+++ b/service-registry/registry-schema-discovery/src/main/java/org/apache/servicecomb/schemadiscovery/SchemaDiscovery.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.servicecomb.core.invocation.endpoint.EndpointUtils;
 import org.apache.servicecomb.foundation.common.base.ServiceCombConstants;
 import org.apache.servicecomb.loadbalance.LoadbalanceHandler;
 import org.apache.servicecomb.provider.pojo.Invoker;
@@ -70,7 +71,8 @@ public class SchemaDiscovery implements Discovery {
 
       for (String endpoint : endpoints) {
         InvocationContext invocationContext = new InvocationContext();
-        invocationContext.addLocalContext(LoadbalanceHandler.SERVICECOMB_SERVER_ENDPOINT, endpoint);
+        invocationContext
+            .addLocalContext(LoadbalanceHandler.SERVICECOMB_SERVER_ENDPOINT, EndpointUtils.parse(endpoint));
         SchemaDiscoveryService schemaDiscoveryService = getOrCreateSchemaDiscoveryService();
         try {
           String schema = schemaDiscoveryService.getSchema(invocationContext, schemaId);
diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
index e201c67..24bbd5b 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/Http2TransportHttpClientOptionsSPI.java
@@ -43,6 +43,11 @@ public class Http2TransportHttpClientOptionsSPI extends HttpTransportHttpClientO
   }
 
   @Override
+  public String getWorkerPoolName() {
+    return "pool-transport-client-http2";
+  }
+
+  @Override
   public boolean isUseAlpn() {
     return TransportClientConfig.getUseAlpn();
   }
diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
index 3bee8df..b449520 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java
@@ -21,7 +21,6 @@ import org.apache.servicecomb.foundation.vertx.client.http.HttpClientOptionsSPI;
 
 import com.netflix.config.ConcurrentCompositeConfiguration;
 
-import io.vertx.core.VertxOptions;
 import io.vertx.core.http.HttpClientOptions;
 import io.vertx.core.http.HttpVersion;
 
@@ -73,17 +72,17 @@ public class HttpTransportHttpClientOptionsSPI implements HttpClientOptionsSPI {
 
   @Override
   public boolean isWorker() {
-    return false;
+    return true;
   }
 
   @Override
   public String getWorkerPoolName() {
-    return null;
+    return "pool-transport-client-http";
   }
 
   @Override
   public int getWorkerPoolSize() {
-    return VertxOptions.DEFAULT_WORKER_POOL_SIZE;
+    return 2;
   }
 
   @Override
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
index a8dee62..626df93 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestTransport.java
@@ -76,6 +76,10 @@ public class VertxRestTransport extends AbstractTransport {
     json.put(ENDPOINT_KEY, getEndpoint());
     json.put(RestTransportClient.class.getName(), restClient);
     options.setConfig(json);
+    // now used not very frequently, hard code its options
+    options.setWorker(true);
+    options.setWorkerPoolName("pool-transport");
+    options.setWorkerPoolSize(2);
     return VertxUtils.blockDeploy(transportVertx, TransportConfig.getRestServerVerticle(), options);
   }