You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The address manager package (addrmgr) for handling available peers currently uses a serialized JSON file for persistence and keeps all known addresses in memory. This is not ideal since, as the number of known good addresses grows, so too does memory consumption (albeit at a pretty slow rate). For example, recent profiling showed it using almost 50 MB on my system currently. Another issue with the current approach is the periodic serialization of the address states has to write a lot more data than is necessary.
It would be ideal to modify the package to take allow it to take advantage of the new bucket capabilities provided by the upcoming redesigned database (#380). However, since the package is also quite useful for non btcd-specific applications, tying it to the new database directly should be avoided. Thus, I propose the package should introduce a new interface which it uses to load and store the relevant data. With the interface in place, callers can provide any concrete implementation of it they need to. For example, btcd could simply implement the interface using the new database capabilities once they're in place and btcwallet could do the same using its database.
In order to provide a smooth transition and default functionality for callers that don't care, as well as tide the package over until the new database lands, I also propose implement taking the current JSON code as a default concrete implementation of the interface. With this in place, the package can be updated now and existing callers can simply use the provided default implementation without any change in behavior. Then, once the new database lands, it would be a simple matter of providing a different concrete implementation to make use of it.
The text was updated successfully, but these errors were encountered:
The address manager package (addrmgr) for handling available peers currently uses a serialized JSON file for persistence and keeps all known addresses in memory. This is not ideal since, as the number of known good addresses grows, so too does memory consumption (albeit at a pretty slow rate). For example, recent profiling showed it using almost 50 MB on my system currently. Another issue with the current approach is the periodic serialization of the address states has to write a lot more data than is necessary.
It would be ideal to modify the package to take allow it to take advantage of the new bucket capabilities provided by the upcoming redesigned database (#380). However, since the package is also quite useful for non btcd-specific applications, tying it to the new database directly should be avoided. Thus, I propose the package should introduce a new interface which it uses to load and store the relevant data. With the interface in place, callers can provide any concrete implementation of it they need to. For example, btcd could simply implement the interface using the new database capabilities once they're in place and btcwallet could do the same using its database.
In order to provide a smooth transition and default functionality for callers that don't care, as well as tide the package over until the new database lands, I also propose implement taking the current JSON code as a default concrete implementation of the interface. With this in place, the package can be updated now and existing callers can simply use the provided default implementation without any change in behavior. Then, once the new database lands, it would be a simple matter of providing a different concrete implementation to make use of it.
The text was updated successfully, but these errors were encountered: