-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(auth): use batch flush & async way to output log #1448
Conversation
More details refer to [doc](xx), here are some points: 1. change log4j2 appender to `RandomAccessFile` to improve perf (default is BufferedOutputStream) 2. change log4j2 to not flush immediately (default is true) 3. use bigger (512K) buffer size (default is 4k) 4. use (LMAX Disruptor) async way to improve log perf (default is sync) 5. separate audit log & server log to keep sever log clean & readable 6. use simple layout format for audit log 7. use `StringBuilder` to reduce about `9%` cost for audit log 8. record mysql connection url info for user issue
Codecov Report
@@ Coverage Diff @@
## master #1448 +/- ##
============================================
+ Coverage 59.68% 62.24% +2.55%
- Complexity 5715 5861 +146
============================================
Files 381 381
Lines 32139 32147 +8
Branches 4504 4504
============================================
+ Hits 19183 20009 +826
+ Misses 10968 10085 -883
- Partials 1988 2053 +65 Continue to review full report at Codecov.
|
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/ResourceObject.java
Outdated
Show resolved
Hide resolved
hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlSessions.java
Outdated
Show resolved
Hide resolved
<!-- Separate audit log, buffer size is 512KB --> | ||
<RollingRandomAccessFile name="audit" fileName="logs/audit-hugegraph-server.log" | ||
filePattern="logs/$${date:yyyy-MM}/audit-hugegraph-server-%d{yyyy-MM-dd}-%i.log" | ||
bufferSize="524288" immediateFlush="false"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use unit like 512kb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems it can't. There is no unit conversion inside
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/ResourceObject.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/ResourceObject.java
Outdated
Show resolved
Hide resolved
some logs of v0.11 server with log-level=debug(before optimize):
blocked threads:
|
More perf details refer to doc, here are some points, for
log4j2
:RandomAccessFile
to improve perf (default is BufferedOutputStream)Others:
StringBuilder
to reduce about9%
cost for audit log