Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
4ebacf09
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ebacf09
编写于
11月 23, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完善Storage压测代码,修复部分bug
上级
f723250d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
195 addition
and
99 deletion
+195
-99
skywalking-network/src/main/java/com/a/eye/skywalking/network/ConsumerProvider.java
...n/java/com/a/eye/skywalking/network/ConsumerProvider.java
+33
-0
skywalking-network/src/main/java/com/a/eye/skywalking/network/ServiceProvider.java
...in/java/com/a/eye/skywalking/network/ServiceProvider.java
+1
-0
skywalking-network/src/main/java/com/a/eye/skywalking/network/exception/ConsumeSpanDataFailedException.java
...ing/network/exception/ConsumeSpanDataFailedException.java
+9
-0
skywalking-network/src/main/java/com/a/eye/skywalking/network/grpc/consumer/SpanStorageConsumer.java
...skywalking/network/grpc/consumer/SpanStorageConsumer.java
+83
-0
skywalking-storage-center/skywalking-storage/pom.xml
skywalking-storage-center/skywalking-storage/pom.xml
+2
-2
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/SpanDataConsumer.java
...a/com/a/eye/skywalking/storage/data/SpanDataConsumer.java
+2
-1
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/index/IndexOperatorFactory.java
...e/skywalking/storage/data/index/IndexOperatorFactory.java
+1
-1
skywalking-storage-center/skywalking-storage/src/test/java/StorageClient.java
...enter/skywalking-storage/src/test/java/StorageClient.java
+10
-91
skywalking-storage-center/skywalking-storage/src/test/java/StorageThread.java
...enter/skywalking-storage/src/test/java/StorageThread.java
+50
-0
skywalking-storage-center/skywalking-storage/src/test/java/com/a/eye/skywalking/storage/SearchClient.java
.../test/java/com/a/eye/skywalking/storage/SearchClient.java
+4
-4
未找到文件。
skywalking-network/src/main/java/com/a/eye/skywalking/network/ConsumerProvider.java
0 → 100644
浏览文件 @
4ebacf09
package
com.a.eye.skywalking.network
;
import
com.a.eye.skywalking.network.grpc.SpanStorageServiceGrpc
;
import
com.a.eye.skywalking.network.grpc.consumer.SpanStorageConsumer
;
import
com.a.eye.skywalking.network.grpc.provider.SpanStorageService
;
import
io.grpc.ManagedChannel
;
import
io.grpc.ManagedChannelBuilder
;
import
static
com
.
a
.
eye
.
skywalking
.
network
.
grpc
.
SpanStorageServiceGrpc
.
newStub
;
public
class
ConsumerProvider
{
private
static
ConsumerProvider
INSTANCE
;
private
ManagedChannel
channel
;
private
SpanStorageServiceGrpc
.
SpanStorageServiceStub
spanStorageStub
;
private
ConsumerProvider
(
String
ip
,
int
address
)
{
channel
=
ManagedChannelBuilder
.
forAddress
(
ip
,
address
).
usePlaintext
(
true
).
build
();
spanStorageStub
=
newStub
(
channel
);
}
public
static
ConsumerProvider
INSTANCE
()
{
return
INSTANCE
;
}
public
SpanStorageConsumer
newSpanStorageConsumer
()
{
return
new
SpanStorageConsumer
(
spanStorageStub
);
}
public
static
ConsumerProvider
init
(
String
ip
,
int
address
)
{
return
INSTANCE
=
new
ConsumerProvider
(
ip
,
address
);
}
}
skywalking-network/src/main/java/com/a/eye/skywalking/network/ServiceProvider.java
浏览文件 @
4ebacf09
...
...
@@ -43,6 +43,7 @@ public class ServiceProvider {
public
static
class
TransferServiceBuilder
{
private
TransferServiceBuilder
(
int
port
)
{
serverBuilder
=
NettyServerBuilder
.
forPort
(
port
);
serverBuilder
.
maxConcurrentCallsPerConnection
(
4
);
}
private
NettyServerBuilder
serverBuilder
;
...
...
skywalking-network/src/main/java/com/a/eye/skywalking/network/exception/ConsumeSpanDataFailedException.java
0 → 100644
浏览文件 @
4ebacf09
package
com.a.eye.skywalking.network.exception
;
/**
* Created by xin on 2016/11/23.
*/
public
class
ConsumeSpanDataFailedException
extends
RuntimeException
{
public
ConsumeSpanDataFailedException
(
Exception
e
)
{
}
}
skywalking-network/src/main/java/com/a/eye/skywalking/network/grpc/consumer/SpanStorageConsumer.java
0 → 100644
浏览文件 @
4ebacf09
package
com.a.eye.skywalking.network.grpc.consumer
;
import
com.a.eye.skywalking.network.exception.ConsumeSpanDataFailedException
;
import
com.a.eye.skywalking.network.grpc.AckSpan
;
import
com.a.eye.skywalking.network.grpc.RequestSpan
;
import
com.a.eye.skywalking.network.grpc.SendResult
;
import
com.a.eye.skywalking.network.grpc.SpanStorageServiceGrpc
;
import
io.grpc.stub.CallStreamObserver
;
import
io.grpc.stub.StreamObserver
;
public
class
SpanStorageConsumer
{
private
final
SpanStorageServiceGrpc
.
SpanStorageServiceStub
spanStorageStub
;
public
SpanStorageConsumer
(
SpanStorageServiceGrpc
.
SpanStorageServiceStub
spanStorageStub
)
{
this
.
spanStorageStub
=
spanStorageStub
;
}
public
void
consumeRequestSpan
(
RequestSpan
...
requestSpan
)
{
StreamObserver
<
RequestSpan
>
requestSpanStreamObserver
=
spanStorageStub
.
storageRequestSpan
(
new
StreamObserver
<
SendResult
>()
{
@Override
public
void
onNext
(
SendResult
sendResult
)
{
}
@Override
public
void
onError
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
@Override
public
void
onCompleted
()
{
}
});
for
(
RequestSpan
span
:
requestSpan
)
{
requestSpanStreamObserver
.
onNext
(
span
);
while
(!((
CallStreamObserver
<
RequestSpan
>)
requestSpanStreamObserver
).
isReady
())
{
try
{
Thread
.
currentThread
().
sleep
(
1
);
}
catch
(
InterruptedException
e
)
{
throw
new
ConsumeSpanDataFailedException
(
e
);
}
}
}
requestSpanStreamObserver
.
onCompleted
();
}
public
void
consumeACKSpan
(
AckSpan
...
ackSpan
)
{
StreamObserver
<
AckSpan
>
ackSpanStreamObserver
=
spanStorageStub
.
storageACKSpan
(
new
StreamObserver
<
SendResult
>()
{
@Override
public
void
onNext
(
SendResult
sendResult
)
{
}
@Override
public
void
onError
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
@Override
public
void
onCompleted
()
{
}
});
for
(
AckSpan
span
:
ackSpan
)
{
ackSpanStreamObserver
.
onNext
(
span
);
while
(!((
CallStreamObserver
<
AckSpan
>)
ackSpanStreamObserver
).
isReady
())
{
try
{
Thread
.
currentThread
().
sleep
(
1
);
}
catch
(
InterruptedException
e
)
{
throw
new
ConsumeSpanDataFailedException
(
e
);
}
}
}
ackSpanStreamObserver
.
onCompleted
();
}
}
skywalking-storage-center/skywalking-storage/pom.xml
浏览文件 @
4ebacf09
...
...
@@ -132,7 +132,7 @@
<unzip
src=
"${project.basedir}/lib/dataindex-es-5.0.1.zip"
dest=
"${project.build.directory}/install/data/index"
/>
<chmod
dir=
"${project.build.directory}/install/data/index/bin"
perm=
"ugo+rx"
includes=
"*
*
"
/>
includes=
"*"
/>
</target>
</configuration>
<goals>
...
...
@@ -157,7 +157,7 @@
<configuration>
<target>
<chmod
dir=
"${project.build.directory}/install/bin"
perm=
"ugo+rx"
includes=
"*
*
"
/>
includes=
"*"
/>
<tar
destfile=
"${project.build.directory}/install.tar"
basedir=
"${project.build.directory}/install"
>
</tar>
</target>
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/SpanDataConsumer.java
浏览文件 @
4ebacf09
...
...
@@ -17,17 +17,18 @@ public class SpanDataConsumer implements IConsumer<SpanData> {
private
static
ILog
logger
=
LogManager
.
getLogger
(
SpanDataConsumer
.
class
);
private
DataFileWriter
fileWriter
;
private
IndexOperator
operator
;
@Override
public
void
init
()
{
fileWriter
=
new
DataFileWriter
();
operator
=
IndexOperatorFactory
.
createIndexOperator
();
}
@Override
public
void
consume
(
List
<
SpanData
>
data
)
{
IndexMetaCollection
collection
=
fileWriter
.
write
(
data
);
IndexOperator
operator
=
IndexOperatorFactory
.
createIndexOperator
();
operator
.
batchUpdate
(
collection
);
HealthCollector
.
getCurrentHeathReading
(
"SpanDataConsumer"
)
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/index/IndexOperatorFactory.java
浏览文件 @
4ebacf09
...
...
@@ -18,7 +18,7 @@ public class IndexOperatorFactory {
public
static
IndexOperator
createIndexOperator
()
{
try
{
return
new
IndexOperator
(
new
PreBuiltTransportClient
(
Settings
.
EMPTY
).
addTransportAddress
(
new
InetSocketTransportAddress
(
InetAddress
.
getLo
calHost
(),
NetUtils
.
getIndexServerPort
()
new
InetSocketTransportAddress
(
InetAddress
.
getLo
opbackAddress
(),
NetUtils
.
getIndexServerPort
()
)));
}
catch
(
Exception
e
)
{
throw
new
IndexOperatorInitializeFailedException
(
"Failed to initialize operator."
,
e
);
...
...
skywalking-storage-center/skywalking-storage/src/test/java/StorageClient.java
浏览文件 @
4ebacf09
import
com.a.eye.skywalking.network.dependencies.io.grpc.ManagedChannel
;
import
com.a.eye.skywalking.network.dependencies.io.grpc.ManagedChannelBuilder
;
import
com.a.eye.skywalking.network.dependencies.io.grpc.stub.ClientCallStreamObserver
;
import
com.a.eye.skywalking.network.dependencies.io.grpc.stub.ServerCallStreamObserver
;
import
com.a.eye.skywalking.network.dependencies.io.grpc.stub.StreamObserver
;
import
com.a.eye.skywalking.network.grpc.*
;
import
com.a.eye.skywalking.network.ConsumerProvider
;
import
static
com
.
a
.
eye
.
skywalking
.
network
.
grpc
.
SpanStorageServiceGrpc
.
newStub
;
import
java.util.concurrent.CountDownLatch
;
public
class
StorageClient
{
private
static
ManagedChannel
channel
=
ManagedChannelBuilder
.
forAddress
(
"127.0.0.1"
,
34000
).
usePlaintext
(
true
).
build
();
private
static
ConsumerProvider
consumerProvider
;
private
static
SpanStorageServiceGrpc
.
SpanStorageServiceStub
spanStorageServiceStub
=
newStub
(
channel
);
private
static
long
endTime1
=
0
;
private
static
long
endTime2
=
0
;
private
static
int
THREAD_COUNT
=
4
;
private
static
final
long
COUNT
=
1_000_000_000
;
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
long
startTime
=
System
.
currentTimeMillis
();
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
long
value
=
System
.
currentTimeMillis
();
RequestSpan
requestSpan
=
RequestSpan
.
newBuilder
().
setSpanType
(
1
).
setAddress
(
"127.0.0.1"
).
setApplicationId
(
"1"
)
.
setCallType
(
"1"
).
setLevelId
(
0
).
setProcessNo
(
"19287"
)
.
setStartDate
(
System
.
currentTimeMillis
()).
setTraceId
(
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
value
)
.
addSegments
(
8504828
).
addSegments
(
2277
).
addSegments
(
53
).
addSegments
(
3
).
build
())
.
setUserId
(
"1"
).
setViewPointId
(
"http://localhost:8080/wwww/test/helloWorld"
).
build
();
AckSpan
ackSpan
=
AckSpan
.
newBuilder
().
setLevelId
(
0
).
setCost
(
10
).
setTraceId
(
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
value
).
addSegments
(
8504828
).
addSegments
(
2277
)
.
addSegments
(
53
).
addSegments
(
3
).
build
()).
setStatusCode
(
0
)
.
setViewpointId
(
"http://localhost:8080/wwww/test/helloWorld"
).
build
();
StreamObserver
<
AckSpan
>
ackSpanStreamObserver
=
spanStorageServiceStub
.
storageACKSpan
(
new
StreamObserver
<
SendResult
>()
{
@Override
public
void
onNext
(
SendResult
sendResult
)
{
}
@Override
public
void
onError
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
@Override
public
void
onCompleted
()
{
endTime1
=
System
.
currentTimeMillis
();
}
});
StreamObserver
<
RequestSpan
>
requestSpanStreamObserver
=
spanStorageServiceStub
.
storageRequestSpan
(
new
StreamObserver
<
SendResult
>()
{
@Override
public
void
onNext
(
SendResult
sendResult
)
{
}
@Override
public
void
onError
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
@Override
public
void
onCompleted
()
{
endTime2
=
System
.
currentTimeMillis
();
}
});
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
requestSpanStreamObserver
.
onNext
(
requestSpan
);
ackSpanStreamObserver
.
onNext
(
ackSpan
);
}
ClientCallStreamObserver
<
RequestSpan
>
newRequestSpanStreamObserver
=
(
ClientCallStreamObserver
<
RequestSpan
>)
requestSpanStreamObserver
;
while
(!
newRequestSpanStreamObserver
.
isReady
())
{
Thread
.
sleep
(
1
);
}
ackSpanStreamObserver
.
onCompleted
();
requestSpanStreamObserver
.
onCompleted
();
if
(
i
%
1_000
==
0
)
{
System
.
out
.
println
(
i
);
}
consumerProvider
=
ConsumerProvider
.
init
(
"10.128.7.241"
,
34000
);
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
THREAD_COUNT
);
for
(
int
i
=
0
;
i
<
THREAD_COUNT
;
i
++)
{
new
StorageThread
(
consumerProvider
,
COUNT
,
countDownLatch
).
start
();
}
Thread
.
sleep
(
1000L
);
System
.
out
.
println
(
"save execute in "
+
(
endTime1
-
startTime
)
+
"ms"
);
System
.
out
.
println
(
"save execute2 in "
+
(
endTime2
-
startTime
)
+
"ms"
);
Thread
.
sleep
(
10000
);
countDownLatch
.
await
();
}
}
skywalking-storage-center/skywalking-storage/src/test/java/StorageThread.java
0 → 100644
浏览文件 @
4ebacf09
import
com.a.eye.skywalking.network.ConsumerProvider
;
import
com.a.eye.skywalking.network.grpc.AckSpan
;
import
com.a.eye.skywalking.network.grpc.RequestSpan
;
import
com.a.eye.skywalking.network.grpc.TraceId
;
import
com.a.eye.skywalking.network.grpc.consumer.SpanStorageConsumer
;
import
com.a.eye.skywalking.storage.util.NetUtils
;
import
java.util.concurrent.CountDownLatch
;
public
class
StorageThread
extends
Thread
{
private
SpanStorageConsumer
consumer
;
private
long
count
;
private
CountDownLatch
countDownLatch
;
StorageThread
(
ConsumerProvider
consumerProvider
,
long
count
,
CountDownLatch
countDownLatch
)
{
consumer
=
consumerProvider
.
newSpanStorageConsumer
();
this
.
count
=
count
;
this
.
countDownLatch
=
countDownLatch
;
}
@Override
public
void
run
()
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
long
value
=
System
.
currentTimeMillis
();
RequestSpan
requestSpan
=
RequestSpan
.
newBuilder
().
setSpanType
(
1
).
setAddress
(
NetUtils
.
getLocalAddress
().
toString
())
.
setApplicationId
(
"1"
).
setCallType
(
"1"
).
setLevelId
(
0
).
setProcessNo
(
"19287"
)
.
setStartDate
(
System
.
currentTimeMillis
()).
setTraceId
(
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
value
).
addSegments
(
8504828
)
.
addSegments
(
2277
).
addSegments
(
53
).
addSegments
(
3
).
build
()).
setUserId
(
"1"
)
.
setViewPointId
(
"http://localhost:8080/wwww/test/helloWorld"
).
build
();
AckSpan
ackSpan
=
AckSpan
.
newBuilder
().
setLevelId
(
0
).
setCost
(
10
).
setTraceId
(
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
value
).
addSegments
(
8504828
).
addSegments
(
2277
)
.
addSegments
(
Thread
.
currentThread
().
getId
()).
addSegments
(
3
).
build
()).
setStatusCode
(
0
)
.
setViewpointId
(
"http://localhost:8080/wwww/test/helloWorld"
).
build
();
consumer
.
consumeACKSpan
(
ackSpan
);
consumer
.
consumeRequestSpan
(
requestSpan
);
if
(
i
%
1_000
==
0
)
{
System
.
out
.
println
(
i
+
" "
+
value
);
}
}
countDownLatch
.
countDown
();
}
}
skywalking-storage-center/skywalking-storage/src/test/java/com/a/eye/skywalking/storage/SearchClient.java
浏览文件 @
4ebacf09
...
...
@@ -10,7 +10,7 @@ import static com.a.eye.skywalking.network.grpc.AsyncTraceSearchServiceGrpc.newS
public
class
SearchClient
{
private
static
ManagedChannel
channel
=
ManagedChannelBuilder
.
forAddress
(
"1
27.0.0.
1"
,
34000
).
usePlaintext
(
true
).
build
();
ManagedChannelBuilder
.
forAddress
(
"1
0.128.7.24
1"
,
34000
).
usePlaintext
(
true
).
build
();
private
static
AsyncTraceSearchServiceGrpc
.
AsyncTraceSearchServiceStub
searchServiceStub
=
newStub
(
channel
);
...
...
@@ -33,11 +33,11 @@ public class SearchClient {
}
};
StreamObserver
<
QueryTask
>
searchResult
=
searchServiceStub
.
search
(
serverStreamObserver
);
StreamObserver
<
QueryTask
>
searchResult
=
searchServiceStub
.
search
(
serverStreamObserver
);
searchResult
.
onNext
(
QueryTask
.
newBuilder
().
setTraceId
(
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
1479
717228982
L
).
addSegments
(
8504828
)
.
addSegments
(
2277
).
addSegments
(
53
).
addSegments
(
3
).
build
()).
setTaskId
(
1
).
build
());
TraceId
.
newBuilder
().
addSegments
(
201611
).
addSegments
(
1479
803629139
L
).
addSegments
(
8504828
)
.
addSegments
(
2277
).
addSegments
(
53
).
addSegments
(
3
).
build
()).
build
());
searchResult
.
onCompleted
();
Thread
.
sleep
(
10000
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录