diff --git a/modules/hydra-collector/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/HydraMysqlServiceImpl.java b/modules/hydra-collector/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/HydraMysqlServiceImpl.java index 8f99242..0defc87 100755 --- a/modules/hydra-collector/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/HydraMysqlServiceImpl.java +++ b/modules/hydra-collector/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/HydraMysqlServiceImpl.java @@ -2,9 +2,11 @@ import com.jd.bdp.hydra.Span; import com.jd.bdp.hydra.dubbomonitor.HydraService; +import com.jd.bdp.hydra.dubbomonitor.provider.impl.support.Configuration; import com.jd.bdp.hydra.store.inter.InsertService; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ExecutorService; @@ -12,24 +14,36 @@ public class HydraMysqlServiceImpl implements HydraService { - private ArrayBlockingQueue> queue = new ArrayBlockingQueue>(1024); + private ArrayBlockingQueue> queue; + private int taskCount=3; private ExecutorService executors = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); - public HydraMysqlServiceImpl(){ - for(int i = 0;i < 3 ;i++){ + public HydraMysqlServiceImpl() { + queue = new ArrayBlockingQueue>(2048); + this.taskCount=3; + for (int i = 0; i < taskCount; i++) { executors.execute(new InsertTask()); } } - class InsertTask implements Runnable{ + public HydraMysqlServiceImpl(Configuration c) { + int queueSize= c.getTaskCount() == null ? 2048 : c.getQueueSize(); + this.taskCount = c.getTaskCount() == null ? 3 : c.getTaskCount(); + queue = new ArrayBlockingQueue>(queueSize); + for (int i = 0; i < taskCount; i++) { + executors.execute(new InsertTask()); + } + } + + class InsertTask implements Runnable { @Override public void run() { - while(true){ + while (true) { try { List span = queue.take(); - if(span != null){ - for(Span s : span){ + if (span != null) { + for (Span s : span) { insertService.addSpan(s); insertService.addTrace(s); insertService.addAnnotation(s); @@ -37,7 +51,7 @@ public void run() { } } catch (InterruptedException e) { //ig - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } @@ -51,6 +65,7 @@ public boolean push(List span) throws IOException { } private InsertService insertService; + public void setInsertService(InsertService insertService) { this.insertService = insertService; } diff --git a/modules/hydra-collector/src/main/resources/collector-common.properties b/modules/hydra-collector/src/main/resources/collector-common.properties new file mode 100755 index 0000000..e6f0e25 --- /dev/null +++ b/modules/hydra-collector/src/main/resources/collector-common.properties @@ -0,0 +1,2 @@ +collector.taskCount=3 +collector.queueSize=2048 diff --git a/modules/hydra-collector/src/main/resources/collector-dbsource.properties b/modules/hydra-collector/src/main/resources/collector-dbsource.properties index 73ad563..fd219bb 100755 --- a/modules/hydra-collector/src/main/resources/collector-dbsource.properties +++ b/modules/hydra-collector/src/main/resources/collector-dbsource.properties @@ -1,5 +1,5 @@ jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://192.168.227.48:3306/hydra-config-pressure-test +jdbc.url=jdbc:mysql://192.168.200.113:3306/hydra-config-pressure-test jdbc.username=root jdbc.password=root a=a diff --git a/modules/hydra-collector/src/main/resources/dubbo-collector.properties b/modules/hydra-collector/src/main/resources/dubbo-collector.properties index 054c0a7..c22bce2 100755 --- a/modules/hydra-collector/src/main/resources/dubbo-collector.properties +++ b/modules/hydra-collector/src/main/resources/dubbo-collector.properties @@ -2,7 +2,7 @@ dubbo.application.name=hydra-collector dubbo.application.owner=jd-bdp dubbo.registry.protocol=zookeeper -dubbo.registry.address=192.168.227.49:2181 +dubbo.registry.address=192.168.228.81:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20889 \ No newline at end of file diff --git a/modules/hydra-collector/src/main/resources/dubbo-hydra-provider-mysql.xml b/modules/hydra-collector/src/main/resources/dubbo-hydra-provider-mysql.xml index b044a26..3ddf0e3 100755 --- a/modules/hydra-collector/src/main/resources/dubbo-hydra-provider-mysql.xml +++ b/modules/hydra-collector/src/main/resources/dubbo-hydra-provider-mysql.xml @@ -10,14 +10,16 @@ default-autowire="byName"> - + - - + + + + - + @@ -25,13 +27,25 @@ - + + + + + classpath:collector-common.properties + + + + + + + + + - - + - + \ No newline at end of file diff --git a/modules/hydra-example/hydra-example-exp1/src/main/resources/dubbo-global.properties b/modules/hydra-example/hydra-example-exp1/src/main/resources/dubbo-global.properties index 8b38d8b..3c5ab4d 100755 --- a/modules/hydra-example/hydra-example-exp1/src/main/resources/dubbo-global.properties +++ b/modules/hydra-example/hydra-example-exp1/src/main/resources/dubbo-global.properties @@ -2,7 +2,7 @@ dubbo.application.name=hydra-example-exp1 dubbo.application.owner=jd-bdp dubbo.registry.protocol=zookeeper -dubbo.registry.address=192.168.227.49:2181 +dubbo.registry.address=192.168.228.81:2181 #dubbo.service.filter=-hydra #dubbo.reference.filter=-hydra \ No newline at end of file diff --git a/modules/hydra-manager-db/src/main/resources/mybatis/mysql.properties b/modules/hydra-manager-db/src/main/resources/mybatis/mysql.properties index 37a879a..e69de29 100755 --- a/modules/hydra-manager-db/src/main/resources/mybatis/mysql.properties +++ b/modules/hydra-manager-db/src/main/resources/mybatis/mysql.properties @@ -1,5 +0,0 @@ -jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/hydra-config -jdbc.username= -jdbc.password= -a=a diff --git a/modules/hydra-manager/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/LeaderServiceImpl.java b/modules/hydra-manager/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/LeaderServiceImpl.java index 51c4a2e..1392fe9 100755 --- a/modules/hydra-manager/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/LeaderServiceImpl.java +++ b/modules/hydra-manager/src/main/java/com/jd/bdp/hydra/dubbomonitor/provider/impl/LeaderServiceImpl.java @@ -18,6 +18,7 @@ public class LeaderServiceImpl implements LeaderService { @Override public Map registerClient(String name, List services) { + System.out.println("接受请求"); long startTime=System.currentTimeMillis(); HashMap map = new HashMap(); map.put("seed", seedService.getSeed().toString()); @@ -25,6 +26,7 @@ public Map registerClient(String name, List services) { for (String serviceName : services) { map.put("serviceName", serviceService.getServiceId(serviceName, name).toString()); } + System.out.println("结束请求"); System.out.println("userTime:"+(System.currentTimeMillis()-startTime)); return map; } diff --git a/modules/hydra-manager/src/main/resources/hydra-manager.properties b/modules/hydra-manager/src/main/resources/hydra-manager.properties index c8d35b9..e03fc44 100755 --- a/modules/hydra-manager/src/main/resources/hydra-manager.properties +++ b/modules/hydra-manager/src/main/resources/hydra-manager.properties @@ -2,7 +2,7 @@ dubbo.application.name=hydra-manager dubbo.application.owner=jd-bdp dubbo.registry.protocol=zookeeper -dubbo.registry.address=192.168.227.49:2181 +dubbo.registry.address=192.168.228.81:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20890 \ No newline at end of file diff --git a/modules/hydra-manager/src/main/resources/hydra-manager.xml b/modules/hydra-manager/src/main/resources/hydra-manager.xml index ae856b9..74853d1 100755 --- a/modules/hydra-manager/src/main/resources/hydra-manager.xml +++ b/modules/hydra-manager/src/main/resources/hydra-manager.xml @@ -7,14 +7,17 @@ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName"> + + + - + @@ -22,7 +25,7 @@ - + diff --git a/modules/hydra-manager/src/main/resources/manager-dbsource.properties b/modules/hydra-manager/src/main/resources/manager-dbsource.properties index 7a4701e..d6e49c6 100755 --- a/modules/hydra-manager/src/main/resources/manager-dbsource.properties +++ b/modules/hydra-manager/src/main/resources/manager-dbsource.properties @@ -1,5 +1,4 @@ jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://192.168.227.48:3306/hydra-config +jdbc.url=jdbc:mysql://192.168.200.113:3306/hydra-config jdbc.username=root -jdbc.password=root -a=a +jdbc.password=root \ No newline at end of file diff --git a/modules/hydra-store/hydra-mysql/src/main/resources/hydra-mysql.xml b/modules/hydra-store/hydra-mysql/src/main/resources/hydra-mysql.xml index 11a8e00..32179cc 100755 --- a/modules/hydra-store/hydra-mysql/src/main/resources/hydra-mysql.xml +++ b/modules/hydra-store/hydra-mysql/src/main/resources/hydra-mysql.xml @@ -23,7 +23,7 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" default-autowire="byName"> - + diff --git a/modules/hydra-store/hydra-mysql/src/main/resources/mybatis/mysql.properties b/modules/hydra-store/hydra-mysql/src/main/resources/mybatis/mysql.properties index 37a879a..ab29e80 100755 --- a/modules/hydra-store/hydra-mysql/src/main/resources/mybatis/mysql.properties +++ b/modules/hydra-store/hydra-mysql/src/main/resources/mybatis/mysql.properties @@ -2,4 +2,3 @@ jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/hydra-config jdbc.username= jdbc.password= -a=a diff --git a/modules/hydra-test/README.md b/modules/hydra-test/README.md index 9517639..8829349 100755 --- a/modules/hydra-test/README.md +++ b/modules/hydra-test/README.md @@ -25,22 +25,22 @@ Hydra 测试 Benchmark/Trigger - 192.168.227.48 + 192.168.200.113 基准测试/冒烟触发器 A - 192.168.227.83 + 192.168.200.110 A B - 192.168.227.86 + 192.168.200.111 B C - 192.168.228.85 + 192.168.200.112 C diff --git a/modules/hydra-test/hydra-test-integration/src/main/java/com/jd/bdp/hydra/benchmark/startTrigger/StartTrigger.java b/modules/hydra-test/hydra-test-integration/src/main/java/com/jd/bdp/hydra/benchmark/startTrigger/StartTrigger.java index f8ca01c..727bd4a 100755 --- a/modules/hydra-test/hydra-test-integration/src/main/java/com/jd/bdp/hydra/benchmark/startTrigger/StartTrigger.java +++ b/modules/hydra-test/hydra-test-integration/src/main/java/com/jd/bdp/hydra/benchmark/startTrigger/StartTrigger.java @@ -15,7 +15,7 @@ public static void main(String[] args) { }); context.start(); Trigger trigger=(Trigger)context.getBean("trigger"); - trigger.startWorkWithSleep(Integer.MAX_VALUE,100); + trigger.startWorkWithSleep(Integer.MAX_VALUE,500); } catch (Exception e) { e.printStackTrace(); } diff --git a/modules/hydra-test/hydra-test-integration/src/main/resources/dubbo.properties b/modules/hydra-test/hydra-test-integration/src/main/resources/dubbo.properties index 220393b..f37a6aa 100755 --- a/modules/hydra-test/hydra-test-integration/src/main/resources/dubbo.properties +++ b/modules/hydra-test/hydra-test-integration/src/main/resources/dubbo.properties @@ -1,7 +1,7 @@ dubbo.application.name=hydra-example dubbo.application.owner=xiangkui dubbo.registry.protocol=zookeeper -dubbo.registry.address=192.168.227.49:2181 +dubbo.registry.address=192.168.228.81:2181 #dubbo.service.filter=-hydra #dubbo.reference.filter=-hydra \ No newline at end of file