Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
0e031eee
Commit
0e031eee
authored
Apr 01, 2019
by
mgravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track the time to get a backlog processor, and the time to get the lock
parent
73d087d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
ExceptionFactory.cs
src/StackExchange.Redis/ExceptionFactory.cs
+2
-1
PhysicalBridge.cs
src/StackExchange.Redis/PhysicalBridge.cs
+8
-0
No files found.
src/StackExchange.Redis/ExceptionFactory.cs
View file @
0e031eee
...
@@ -283,9 +283,10 @@ void add(string lk, string sk, string v)
...
@@ -283,9 +283,10 @@ void add(string lk, string sk, string v)
};
};
if
(
data
!=
null
)
if
(
data
!=
null
)
{
{
var
exData
=
ex
.
Data
;
foreach
(
var
kv
in
data
)
foreach
(
var
kv
in
data
)
{
{
ex
.
Data
[
"Redis-"
+
kv
.
Item1
]
=
kv
.
Item2
;
exData
[
"Redis-"
+
kv
.
Item1
]
=
kv
.
Item2
;
}
}
}
}
...
...
src/StackExchange.Redis/PhysicalBridge.cs
View file @
0e031eee
...
@@ -738,8 +738,10 @@ private bool PushToBacklog(Message message, bool onlyIfExists)
...
@@ -738,8 +738,10 @@ private bool PushToBacklog(Message message, bool onlyIfExists)
private
void
StartBacklogProcessor
()
private
void
StartBacklogProcessor
()
{
{
var
sched
=
Multiplexer
.
SocketManager
?.
SchedulerPool
??
DedicatedThreadPoolPipeScheduler
.
Default
;
var
sched
=
Multiplexer
.
SocketManager
?.
SchedulerPool
??
DedicatedThreadPoolPipeScheduler
.
Default
;
_backlogProcessorRequestedTime
=
Environment
.
TickCount
;
sched
.
Schedule
(
s_ProcessBacklog
,
_weakRefThis
);
sched
.
Schedule
(
s_ProcessBacklog
,
_weakRefThis
);
}
}
private
volatile
int
_backlogProcessorRequestedTime
;
private
static
readonly
Action
<
object
>
s_ProcessBacklog
=
s
=>
private
static
readonly
Action
<
object
>
s_ProcessBacklog
=
s
=>
{
{
...
@@ -788,6 +790,8 @@ private void ProcessBacklog()
...
@@ -788,6 +790,8 @@ private void ProcessBacklog()
LockToken
token
=
default
;
LockToken
token
=
default
;
try
try
{
{
int
tryToAcquireTime
=
Environment
.
TickCount
;
var
msToStartWorker
=
unchecked
(
tryToAcquireTime
-
_backlogProcessorRequestedTime
);
while
(
true
)
while
(
true
)
{
{
// try and get the lock; if unsuccessful, check for termination
// try and get the lock; if unsuccessful, check for termination
...
@@ -796,6 +800,8 @@ private void ProcessBacklog()
...
@@ -796,6 +800,8 @@ private void ProcessBacklog()
lock
(
_backlog
)
{
if
(
_backlog
.
Count
==
0
)
return
;
}
lock
(
_backlog
)
{
if
(
_backlog
.
Count
==
0
)
return
;
}
}
}
_backlogStatus
=
BacklogStatus
.
Started
;
_backlogStatus
=
BacklogStatus
.
Started
;
int
acquiredTime
=
Environment
.
TickCount
;
var
msToGetLock
=
unchecked
(
acquiredTime
-
tryToAcquireTime
);
// so now we are the writer; write some things!
// so now we are the writer; write some things!
Message
message
;
Message
message
;
...
@@ -816,6 +822,8 @@ private void ProcessBacklog()
...
@@ -816,6 +822,8 @@ private void ProcessBacklog()
{
{
_backlogStatus
=
BacklogStatus
.
RecordingTimeout
;
_backlogStatus
=
BacklogStatus
.
RecordingTimeout
;
var
ex
=
Multiplexer
.
GetException
(
WriteResult
.
TimeoutBeforeWrite
,
message
,
ServerEndPoint
);
var
ex
=
Multiplexer
.
GetException
(
WriteResult
.
TimeoutBeforeWrite
,
message
,
ServerEndPoint
);
ex
.
Data
[
"Redis-BacklogStartDelay"
]
=
msToStartWorker
;
ex
.
Data
[
"Redis-BacklogGetLocDelay"
]
=
msToGetLock
;
message
.
SetExceptionAndComplete
(
ex
,
this
);
message
.
SetExceptionAndComplete
(
ex
,
this
);
}
}
else
else
...
...
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