Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
3ddf3e6b
Commit
3ddf3e6b
authored
Dec 28, 2016
by
张乐
Committed by
GitHub
Dec 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #505 from nobodyiam/config-service-optimize
Config service optimize
parents
75bed9b3
967041c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
28 deletions
+10
-28
pom.xml
apollo-adminservice/pom.xml
+0
-10
pom.xml
apollo-configservice/pom.xml
+0
-10
InstanceConfigAuditUtil.java
...rk/apollo/configservice/util/InstanceConfigAuditUtil.java
+10
-0
pom.xml
apollo-portal/pom.xml
+0
-8
No files found.
apollo-adminservice/pom.xml
View file @
3ddf3e6b
...
@@ -96,14 +96,4 @@
...
@@ -96,14 +96,4 @@
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<profiles>
<profile>
<id>
github
</id>
<properties>
<package.environment>
github
</package.environment>
</properties>
<dependencies>
</dependencies>
</profile>
</profiles>
</project>
</project>
apollo-configservice/pom.xml
View file @
3ddf3e6b
...
@@ -97,14 +97,4 @@
...
@@ -97,14 +97,4 @@
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<profiles>
<profile>
<id>
github
</id>
<properties>
<package.environment>
github
</package.environment>
</properties>
<dependencies>
</dependencies>
</profile>
</profiles>
</project>
</project>
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/util/InstanceConfigAuditUtil.java
View file @
3ddf3e6b
...
@@ -36,6 +36,7 @@ public class InstanceConfigAuditUtil implements InitializingBean {
...
@@ -36,6 +36,7 @@ public class InstanceConfigAuditUtil implements InitializingBean {
private
static
final
int
INSTANCE_CONFIG_AUDIT_MAX_SIZE
=
2000
;
private
static
final
int
INSTANCE_CONFIG_AUDIT_MAX_SIZE
=
2000
;
private
static
final
int
INSTANCE_CACHE_MAX_SIZE
=
10000
;
private
static
final
int
INSTANCE_CACHE_MAX_SIZE
=
10000
;
private
static
final
int
INSTANCE_CONFIG_CACHE_MAX_SIZE
=
10000
;
private
static
final
int
INSTANCE_CONFIG_CACHE_MAX_SIZE
=
10000
;
private
static
final
long
OFFER_TIME_LAST_MODIFIED_TIME_THRESHOLD_IN_MILLI
=
TimeUnit
.
MINUTES
.
toMillis
(
10
);
//10 minutes
private
static
final
Joiner
STRING_JOINER
=
Joiner
.
on
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
);
private
static
final
Joiner
STRING_JOINER
=
Joiner
.
on
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
);
private
final
ExecutorService
auditExecutorService
;
private
final
ExecutorService
auditExecutorService
;
private
final
AtomicBoolean
auditStopped
;
private
final
AtomicBoolean
auditStopped
;
...
@@ -93,6 +94,10 @@ public class InstanceConfigAuditUtil implements InitializingBean {
...
@@ -93,6 +94,10 @@ public class InstanceConfigAuditUtil implements InitializingBean {
instanceConfig
.
setConfigClusterName
(
auditModel
.
getConfigClusterName
());
instanceConfig
.
setConfigClusterName
(
auditModel
.
getConfigClusterName
());
instanceConfig
.
setReleaseKey
(
auditModel
.
getReleaseKey
());
instanceConfig
.
setReleaseKey
(
auditModel
.
getReleaseKey
());
instanceConfig
.
setReleaseDeliveryTime
(
auditModel
.
getOfferTime
());
instanceConfig
.
setReleaseDeliveryTime
(
auditModel
.
getOfferTime
());
}
else
if
(
offerTimeAndLastModifiedTimeCloseEnough
(
auditModel
.
getOfferTime
(),
instanceConfig
.
getDataChangeLastModifiedTime
()))
{
//when releaseKey is the same, optimize to reduce writes if the record was updated not long ago
return
;
}
}
//we need to update no matter the release key is the same or not, to ensure the
//we need to update no matter the release key is the same or not, to ensure the
//last modified time is updated each day
//last modified time is updated each day
...
@@ -117,6 +122,11 @@ public class InstanceConfigAuditUtil implements InitializingBean {
...
@@ -117,6 +122,11 @@ public class InstanceConfigAuditUtil implements InitializingBean {
}
}
}
}
private
boolean
offerTimeAndLastModifiedTimeCloseEnough
(
Date
offerTime
,
Date
lastModifiedTime
)
{
return
(
offerTime
.
getTime
()
-
lastModifiedTime
.
getTime
())
<
OFFER_TIME_LAST_MODIFIED_TIME_THRESHOLD_IN_MILLI
;
}
private
long
prepareInstanceId
(
InstanceConfigAuditModel
auditModel
)
{
private
long
prepareInstanceId
(
InstanceConfigAuditModel
auditModel
)
{
Instance
instance
=
instanceService
.
findInstance
(
auditModel
.
getAppId
(),
auditModel
Instance
instance
=
instanceService
.
findInstance
(
auditModel
.
getAppId
(),
auditModel
.
getClusterName
(),
auditModel
.
getDataCenter
(),
auditModel
.
getIp
());
.
getClusterName
(),
auditModel
.
getDataCenter
(),
auditModel
.
getIp
());
...
...
apollo-portal/pom.xml
View file @
3ddf3e6b
...
@@ -70,13 +70,5 @@
...
@@ -70,13 +70,5 @@
</dependency>
</dependency>
</dependencies>
</dependencies>
</profile>
</profile>
<profile>
<id>
github
</id>
<properties>
<package.environment>
github
</package.environment>
</properties>
<dependencies>
</dependencies>
</profile>
</profiles>
</profiles>
</project>
</project>
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