-
Notifications
You must be signed in to change notification settings - Fork 463
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
feat: file based naming resolver #1380
Conversation
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
@daixiang0 can you please review this? |
@yaron2 sure. |
nameresolution/file/file.go
Outdated
|
||
// ResolveID resolves name to address via file. | ||
func (r *resolver) ResolveID(req nameresolution.ResolveRequest) (string, error) { | ||
lock := r.newFileLock(req.ID) |
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 we need to read files when a request comes, how about reading one time then handle all route info, only re-read when the file changes?
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 this be cached too? Maybe the file update happens in the background instead and the ResolveID() method will only do a lookup on a in-memory hash table.
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.
introduce filewatcher to load naming info only when necessary.
ping @beiwei30 |
sorry for late response, will follow up the review comments today. |
Signed-off-by: Ian Luo <ian.luo@gmail.com>
@daixiang0 @artursouza I have updated this PR, pls. take a look again. |
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Ian Luo <ian.luo@gmail.com>
af124b9
to
d7cfaf9
Compare
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
@beiwei30 can you please run |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Codecov Report
@@ Coverage Diff @@
## master #1380 +/- ##
==========================================
- Coverage 37.62% 36.57% -1.05%
==========================================
Files 192 167 -25
Lines 23982 15640 -8342
==========================================
- Hits 9023 5721 -3302
+ Misses 14193 9272 -4921
+ Partials 766 647 -119
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@beiwei30 -
Also having 777 file permissions allows anyone to write to the nameresolution file which is a security issue, since the consuming app can be misguided to connect to any endpoint. To complete this solution, there should be a cleanup of the nameresolution information. when file is chosen as name resolution - dapr cli can periodically check if all the apps as running and clean up the nameresolution information to be accurate - thoughts? @mukundansundar @berndverst |
I think we need someone to create a design document for the overall design / experience including the CLI, and the various edge cases before we should proceed here. This feature is useful, but there seem to be plenty of gaps. |
@berndverst and I synced yesterday, and I agree a file-based nameresolver should happen in 1.13, but IMHO this should be based on SQLIte. Using a single SQLite database will already solve problems such as concurrent access by multiple sidecars (locking, etc). A single file is also easier to handle and to garbage-collect. Lastly, SQLite is also generally faster than the filesystem for these kinds of things. |
Description
Provide a file based naming resolver to replace mDNS so that dapr can address each other either on the same host or via shared file system, which would be more stable and friendly for development.
The default directory to keep naming informations is:
$HOME/.dapr/naming
, and it can be customized in Dapr's config.yaml:Pro and con of this solution:
Issue reference
This PR will close: dapr/dapr#3256
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: