Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fairblue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hosting
chat
fairblue
Commits
8726ec29
Commit
8726ec29
authored
8 years ago
by
Anton Georgiev
Browse files
Options
Downloads
Patches
Plain Diff
add JVM Heap monitor updated every 5 sec
parent
f0a18f62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java
+37
-1
37 additions, 1 deletion
...java/org/bigbluebutton/red5/BigBlueButtonApplication.java
with
37 additions
and
1 deletion
bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java
+
37
−
1
View file @
8726ec29
...
...
@@ -22,6 +22,10 @@ import java.util.HashMap;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
org.bigbluebutton.red5.client.messaging.ConnectionInvokerService
;
import
org.bigbluebutton.red5.pubsub.MessagePublisher
;
import
org.red5.logging.Red5LoggerFactory
;
...
...
@@ -80,9 +84,41 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
public
boolean
appStart
(
IScope
app
)
{
super
.
appStart
(
app
);
connInvokerService
.
setAppScope
(
app
);
getHeapStats
();
return
true
;
}
private
void
getHeapStats
()
{
Runnable
getHeapTask
=
()
->
getHeapStatsHelper
();
ScheduledExecutorService
executor
=
Executors
.
newScheduledThreadPool
(
1
);
executor
.
scheduleAtFixedRate
(
getHeapTask
,
0
,
5
,
TimeUnit
.
SECONDS
);
}
private
void
getHeapStatsHelper
()
{
int
mb
=
1024
*
1024
;
// Getting the runtime reference from system
Runtime
runtime
=
Runtime
.
getRuntime
();
long
usedMemory
=
(
runtime
.
totalMemory
()
-
runtime
.
freeMemory
())
/
mb
;
long
freeMemory
=
runtime
.
freeMemory
()
/
mb
;
long
totalMemory
=
runtime
.
totalMemory
()
/
mb
;
long
maxMemory
=
runtime
.
maxMemory
()
/
mb
;
Map
<
String
,
Object
>
logData
=
new
HashMap
<
String
,
Object
>();
logData
.
put
(
"used"
,
usedMemory
);
logData
.
put
(
"free"
,
freeMemory
);
logData
.
put
(
"total"
,
totalMemory
);
logData
.
put
(
"max"
,
maxMemory
);
Gson
gson
=
new
Gson
();
String
logStr
=
gson
.
toJson
(
logData
);
log
.
info
(
"JVM Heap [MB] data={}"
,
logStr
);
}
@Override
public
void
appStop
(
IScope
app
)
{
super
.
appStop
(
app
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment