Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
beaf0a91
Commit
beaf0a91
authored
Oct 16, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java实例内存大小监控
parent
525a898e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
core/src/main/java/com/wecloud/im/controller/SignController.java
+15
-7
No files found.
core/src/main/java/com/wecloud/im/controller/SignController.java
View file @
beaf0a91
...
@@ -3,6 +3,7 @@ package com.wecloud.im.controller;
...
@@ -3,6 +3,7 @@ package com.wecloud.im.controller;
import
cn.hutool.crypto.digest.MD5
;
import
cn.hutool.crypto.digest.MD5
;
import
com.wecloud.im.param.GetSignParam
;
import
com.wecloud.im.param.GetSignParam
;
import
com.wecloud.im.ws.manager.ChannelManager
;
import
com.wecloud.im.ws.manager.ChannelManager
;
import
com.wecloud.im.ws.model.ClientInfo
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -43,7 +44,13 @@ public class SignController extends BaseController {
...
@@ -43,7 +44,13 @@ public class SignController extends BaseController {
@ApiOperation
(
value
=
"monitor"
,
notes
=
"monitor"
)
@ApiOperation
(
value
=
"monitor"
,
notes
=
"monitor"
)
public
String
monitor
()
{
public
String
monitor
()
{
int
sessionInfoMapSize
=
ChannelManager
.
SESSION_INFO_MAP
.
size
();
int
sessionInfoMapSize
=
ChannelManager
.
SESSION_INFO_MAP
.
size
();
String
sizeStr
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
SESSION_INFO_MAP
);
Long
sizeStr
=
RamUsageEstimator
.
sizeOf
(
ChannelManager
.
SESSION_INFO_MAP
);
Long
total
=
0L
;
for
(
ClientInfo
value
:
ChannelManager
.
SESSION_INFO_MAP
.
values
())
{
Long
size
=
RamUsageEstimator
.
sizeOf
(
value
);
log
.
info
(
"size: {}"
,
size
);
total
+=
size
;
}
String
sizeClientId
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
CLIENT_ID
);
String
sizeClientId
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
CLIENT_ID
);
String
sizeAppId
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
APPLICATION_ID
);
String
sizeAppId
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
APPLICATION_ID
);
...
@@ -51,12 +58,13 @@ public class SignController extends BaseController {
...
@@ -51,12 +58,13 @@ public class SignController extends BaseController {
String
sizePlatform
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
PLATFORM
);
String
sizePlatform
=
RamUsageEstimator
.
humanSizeOf
(
ChannelManager
.
PLATFORM
);
StringBuilder
sb
=
new
StringBuilder
()
StringBuilder
sb
=
new
StringBuilder
()
.
append
(
"sessionInfoMapSize: "
).
append
(
sessionInfoMapSize
).
append
(
"\n"
)
.
append
(
"sessionInfoMapSize: "
).
append
(
sessionInfoMapSize
).
append
(
"---"
)
.
append
(
"sizeStr:"
).
append
(
sizeStr
).
append
(
"\n"
)
.
append
(
"sizeStr:"
).
append
(
sizeStr
).
append
(
"---"
)
.
append
(
"sizeClientId:"
).
append
(
sizeClientId
).
append
(
"\n"
)
.
append
(
"total:"
).
append
(
total
).
append
(
"---"
)
.
append
(
"sizeAppId:"
).
append
(
sizeAppId
).
append
(
"\n"
)
.
append
(
"sizeClientId:"
).
append
(
sizeClientId
).
append
(
"---"
)
.
append
(
"sizeReadIdle:"
).
append
(
sizeReadIdle
).
append
(
"\n"
)
.
append
(
"sizeAppId:"
).
append
(
sizeAppId
).
append
(
"---"
)
.
append
(
"sizePlatform:"
).
append
(
sizePlatform
).
append
(
"\n"
)
.
append
(
"sizeReadIdle:"
).
append
(
sizeReadIdle
).
append
(
"---"
)
.
append
(
"sizePlatform:"
).
append
(
sizePlatform
).
append
(
"---"
)
;
;
log
.
info
(
sb
.
toString
());
log
.
info
(
sb
.
toString
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment