[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r206766484 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml ## @@ -17,7 +17,7 @@ APPLICATION_ID: pojotest-it service_description: - name: pojo-connection-limit + name: pojo Review comment: at last, we will move integration test to real SC, not a mock SC, your logic will cause conflict in that time. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r205660724 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientClosedEvent.java ## @@ -17,6 +17,9 @@ package org.apache.servicecomb.foundation.vertx; +/** Review comment: sorry, i made a mistake caused by the char "+" This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r205660307 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml ## @@ -0,0 +1,29 @@ +## --- +## 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. +## --- + +APPLICATION_ID: pojotest-it +service_description: + name: pojo + version: 0.0.4 +servicecomb: + service: +registry: + address: http://127.0.0.1:30100 + highway: +address: 0.0.0.0:7070 +server: + connection-limit: 0 Review comment: already depend on pojo-test jar and you want to reuse it's declare so only need to append new config items, no need to declare everything again. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r205660228 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringMain.java ## @@ -0,0 +1,31 @@ +/* + * 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.pojo.test; + +import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableServiceComb +public class PojoSpringMain { + + public static void main(final String[] args) { +SpringApplication.run(PojoSpringMain.class, args); Review comment: already depend on pojo-test jar just invoke org.apache.servicecomb.demo.pojo.test.PojoTestMain no need to depend on complex springboot This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r205660152 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/log4j.properties ## @@ -0,0 +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. +# +log4j.rootLogger=INFO, stdout Review comment: already depend on pojo-test jar, can remove this file This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r205644248 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml ## @@ -17,7 +17,7 @@ APPLICATION_ID: pojotest-it service_description: - name: pojo-connection-limit + name: pojo Review comment: conflict with integration-tests/pojo-test This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r204226639 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml ## @@ -0,0 +1,29 @@ +## --- +## 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. +## --- + +APPLICATION_ID: pojotest-it +service_description: + name: pojo + version: 0.0.4 +servicecomb: + service: +registry: + address: http://127.0.0.1:30100 + highway: +address: 0.0.0.0:7070 +server: + connection-limit: 0 Review comment: discuss with customers, we should support this. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203954150 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java ## @@ -18,23 +18,35 @@ package org.apache.servicecomb.foundation.vertx.server; import java.net.InetSocketAddress; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.servicecomb.foundation.common.event.EventManager; import org.apache.servicecomb.foundation.common.net.URIEndpointObject; import org.apache.servicecomb.foundation.ssl.SSLCustom; import org.apache.servicecomb.foundation.ssl.SSLOption; import org.apache.servicecomb.foundation.ssl.SSLOptionFactory; import org.apache.servicecomb.foundation.vertx.AsyncResultCallback; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; import org.apache.servicecomb.foundation.vertx.VertxTLSBuilder; +import com.netflix.config.DynamicPropertyFactory; + import io.vertx.core.Vertx; import io.vertx.core.net.NetServer; import io.vertx.core.net.NetServerOptions; public class TcpServer { private URIEndpointObject endpointObject; + private final AtomicInteger connectedCounter; Review comment: if serivcecomb.highway.thread-count is n, then HighwayServerVerticle instance count is n This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203953876 ## File path: integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java ## @@ -0,0 +1,44 @@ +/* + * 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.pojo.test; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.servicecomb.foundation.vertx.ClientClosedEvent; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; + +import com.google.common.eventbus.Subscribe; + +public class ConnectionEventWatcher { + private final List counters = new ArrayList<>(); + + public List getCounters() { +return counters; + } + + @Subscribe Review comment: what's this watcher purpose? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203953811 ## File path: integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java ## @@ -0,0 +1,44 @@ +/* + * 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.pojo.test; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.servicecomb.foundation.vertx.ClientClosedEvent; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; + +import com.google.common.eventbus.Subscribe; + +public class ConnectionEventWatcher { + private final List counters = new ArrayList<>(); + + public List getCounters() { +return counters; + } + + @Subscribe Review comment: all eventloop thread will sync invoke this it's not a good sample. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203953673 ## File path: integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml ## @@ -0,0 +1,29 @@ +## --- +## 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. +## --- + +APPLICATION_ID: pojotest-it +service_description: + name: pojo + version: 0.0.4 +servicecomb: + service: +registry: + address: http://127.0.0.1:30100 + highway: +address: 0.0.0.0:7070 +server: + connection-limit: 0 Review comment: consider dynamic update? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203948367 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java ## @@ -18,23 +18,35 @@ package org.apache.servicecomb.foundation.vertx.server; import java.net.InetSocketAddress; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.servicecomb.foundation.common.event.EventManager; import org.apache.servicecomb.foundation.common.net.URIEndpointObject; import org.apache.servicecomb.foundation.ssl.SSLCustom; import org.apache.servicecomb.foundation.ssl.SSLOption; import org.apache.servicecomb.foundation.ssl.SSLOptionFactory; import org.apache.servicecomb.foundation.vertx.AsyncResultCallback; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; import org.apache.servicecomb.foundation.vertx.VertxTLSBuilder; +import com.netflix.config.DynamicPropertyFactory; + import io.vertx.core.Vertx; import io.vertx.core.net.NetServer; import io.vertx.core.net.NetServerOptions; public class TcpServer { private URIEndpointObject endpointObject; + private final AtomicInteger connectedCounter; Review comment: TcpServer will be created for each HighwayServerVerticle instance so the counter number in server is not correct. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection
wujimin commented on a change in pull request #824: [SCB-687] add highway server connection protection URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203929543 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java ## @@ -57,8 +69,18 @@ public void init(Vertx vertx, String sslKey, AsyncResultCallback { - TcpServerConnection connection = createTcpServerConnection(); - connection.init(netSocket); + if (connectedCounter.get() < connectionLimit) { Review comment: seems this is more clear. ``` if (connectedCounter.incrementAndGet() > connectionLimit){ connectedCounter.decrementAndGet(); netSocket.close(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket, connectedCounter); EventManager.post(new ClientConnectedEvent(netSocket, connectedCount)); ``` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services