You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/06/28 06:59:56 UTC

[GitHub] [servicecomb-service-center] fuziye01 opened a new pull request #1077: Get service/instance from cache (#1066)

fuziye01 opened a new pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077


   【issue】: #1066
   
   【特性/模块名称】:缓存优化
   
   【修改内容】:
   1.所有查询service/instance的地方都由从db查询修改为先从缓存中查询,如果缓存中没有再查db
   根据version版本匹配的地方暂未修改,后续实现了缓存version匹配再修改
   
   2.service/instance的index由原来的{serviceID}修改为{domain}/{project}/{serviceID}的形式
   否则多域下出现serviceID相同的情况查询会有问题
   
   【自测情况】:
   测试通过


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
robotLJW commented on a change in pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077#discussion_r660237884



##########
File path: datasource/cache/ms_cache.go
##########
@@ -21,17 +21,18 @@ import (
 	"context"
 	"strings"
 
-	"github.com/go-chassis/cari/discovery"
-
 	"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
 	"github.com/apache/servicecomb-service-center/datasource/mongo/sd"
 	"github.com/apache/servicecomb-service-center/pkg/util"
+	"github.com/go-chassis/cari/discovery"
 )
 
 const (
 	Provider = "p"
+	Split    = "/"
 )
 
+// dep cache

Review comment:
       函数头加注释,类似这样,说明下是干啥的
   // Add adds an entity to the list.
   func (l *AbstractList) Add(e Entity) {
     // ...
   }




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077#discussion_r660232298



##########
File path: datasource/mongo/sd/instancec_test.go
##########
@@ -71,17 +71,17 @@ func TestInstCacheBasicFunc(t *testing.T) {
 		assert.Equal(t, instanceCache.cache.Size(), 1)
 		assert.Nil(t, instanceCache.cache.Get("id_not_exist"))
 		assert.Equal(t, inst1.Instance.InstanceId, instanceCache.cache.Get("id1").(model.Instance).Instance.InstanceId)
-		assert.Len(t, instanceCache.cache.GetValue("svcid"), 1)
+		assert.Len(t, instanceCache.cache.GetValue("default/default/svcid"), 1)

Review comment:
       增加下test case 验证增删改service后缓存的正确性




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077#discussion_r660228943



##########
File path: datasource/cache/ms_cache.go
##########
@@ -21,17 +21,18 @@ import (
 	"context"
 	"strings"
 
-	"github.com/go-chassis/cari/discovery"
-
 	"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
 	"github.com/apache/servicecomb-service-center/datasource/mongo/sd"
 	"github.com/apache/servicecomb-service-center/pkg/util"
+	"github.com/go-chassis/cari/discovery"
 )
 
 const (
 	Provider = "p"
+	Split    = "/"

Review comment:
       能不能抽取这些常量,和etcd共用

##########
File path: datasource/mongo/sd/instancec_test.go
##########
@@ -71,17 +71,17 @@ func TestInstCacheBasicFunc(t *testing.T) {
 		assert.Equal(t, instanceCache.cache.Size(), 1)
 		assert.Nil(t, instanceCache.cache.Get("id_not_exist"))
 		assert.Equal(t, inst1.Instance.InstanceId, instanceCache.cache.Get("id1").(model.Instance).Instance.InstanceId)
-		assert.Len(t, instanceCache.cache.GetValue("svcid"), 1)
+		assert.Len(t, instanceCache.cache.GetValue("default/default/svcid"), 1)

Review comment:
       增加下test case 验证增删改service后缓存的正确性




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] robotLJW commented on a change in pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
robotLJW commented on a change in pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077#discussion_r660237884



##########
File path: datasource/cache/ms_cache.go
##########
@@ -21,17 +21,18 @@ import (
 	"context"
 	"strings"
 
-	"github.com/go-chassis/cari/discovery"
-
 	"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
 	"github.com/apache/servicecomb-service-center/datasource/mongo/sd"
 	"github.com/apache/servicecomb-service-center/pkg/util"
+	"github.com/go-chassis/cari/discovery"
 )
 
 const (
 	Provider = "p"
+	Split    = "/"
 )
 
+// dep cache

Review comment:
       函数头加注释,类似这样,说明下是干啥的
   // Add adds an entity to the list.
   func (l *AbstractList) Add(e Entity) {
     // ...
   }




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077#discussion_r660228943



##########
File path: datasource/cache/ms_cache.go
##########
@@ -21,17 +21,18 @@ import (
 	"context"
 	"strings"
 
-	"github.com/go-chassis/cari/discovery"
-
 	"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
 	"github.com/apache/servicecomb-service-center/datasource/mongo/sd"
 	"github.com/apache/servicecomb-service-center/pkg/util"
+	"github.com/go-chassis/cari/discovery"
 )
 
 const (
 	Provider = "p"
+	Split    = "/"

Review comment:
       能不能抽取这些常量,和etcd共用




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang merged pull request #1077: Get service/instance from cache (#1066)

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #1077:
URL: https://github.com/apache/servicecomb-service-center/pull/1077


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org