KamToHung commented on code in PR #3034:
URL: https://github.com/apache/dubbo-go/pull/3034#discussion_r2443348864


##########
server/server.go:
##########
@@ -39,13 +39,21 @@ import (
 )
 
 // proServices are for internal services
-var proServices = make([]*InternalService, 0, 16)
-var proLock sync.Mutex
+var internalProServices = make([]*InternalService, 0, 16)
+var internalProLock sync.Mutex
 
 type Server struct {
        cfg *ServerOptions
 
-       svcOptsMap sync.Map
+       mu sync.RWMutex
+       // key: *ServiceOptions, value: *common.ServiceInfo
+       //proServices map[string]common.RPCService
+       // change any to *common.ServiceInfo @see config/service.go
+       svcOptsMap map[string]*ServiceOptions
+       // key is interface name, value is *ServiceOptions
+       interfaceNameServices map[string]*ServiceOptions
+       // indicate whether the server is already started
+       serve bool
 }
 

Review Comment:
   > The introduction of mu and the switch from sync.Map to map + RWMutex 
require stress testing to verify concurrency performance under load.
   
   I think that registering a service happens during project startup. In most 
cases, you wouldn't actively register a service after startup activities, so 
there's basically no concurrency issue here. The lock is just added for code 
robustness.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to