Skip to content
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

optimize layer storage format for mem size and perf #1877

Merged
merged 14 commits into from
Sep 22, 2020
Merged

Conversation

invisig0th
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Sep 21, 2020

Codecov Report

Merging #1877 into master will decrease coverage by 0.10%.
The diff coverage is 97.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1877      +/-   ##
==========================================
- Coverage   96.62%   96.51%   -0.11%     
==========================================
  Files         141      139       -2     
  Lines       27769    26023    -1746     
==========================================
- Hits        26832    25117    -1715     
+ Misses        937      906      -31     
Flag Coverage Δ
#linux 96.51% <97.39%> (-0.11%) ⬇️
#linux_replay 69.73% <83.38%> (+4.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
synapse/lib/layer.py 97.75% <97.12%> (-0.07%) ⬇️
synapse/lib/lmdbslab.py 99.59% <100.00%> (+<0.01%) ⬆️
synapse/lib/snap.py 94.76% <100.00%> (+0.02%) ⬆️
synapse/lib/trigger.py 92.95% <0.00%> (-0.89%) ⬇️
synapse/datamodel.py 94.67% <0.00%> (-0.24%) ⬇️
synapse/cortex.py 95.71% <0.00%> (ø)
synapse/tests/utils.py 95.65% <0.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 644b693...a641565. Read the comment docs.

@invisig0th invisig0th changed the title WIP: optimize layer storage format for mem size and perf optimize layer storage format for mem size and perf Sep 22, 2020
@invisig0th invisig0th merged commit c26c602 into master Sep 22, 2020
@invisig0th invisig0th deleted the visi-layerv3 branch September 22, 2020 16:12
@vEpiphyte vEpiphyte added this to the 2.9.0 milestone Sep 22, 2020
if byts is not None:
return s_msgpack.un(byts)[1]
sode = self.layr._getStorNode(buid)
valt = sode.get('valu')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valt vs valu? just a odd style nit but it seems weird to have a inconsistent label in the codebase

sode.clear()

if len(tostor) >= 10000:
logger.warning('...syncing 10k nodes')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an incrementing counter would be useful here

tostor = []
lastbuid = None

logger.warning(f'Converting layer from v2 to v3 storage: {self.dirn}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we really could do an estimated magnitude based on form counts (but not an absolute count)

# mop up the left overs
if tostor:
self.layrslab.putmulti(tostor, db=self.bybuidv3)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this drop could take a while. worth noting that we're dropping the table

@@ -368,6 +368,7 @@ async def nodesByProp(self, full):
for layr in self.layers:
genr = layr.liftByProp(None, prop.name)
async for node in self._joinStorGenr(layr, genr):
# TODO should these type of filters yield?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no todos in mainline code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err fixmes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a question about how many results one could have that whiff in the continue block or not. that's really the question about yielding here.

@@ -661,35 +661,17 @@ async def test_layer_stortype_merge(self):
nodes = await core.nodes('inet:ipv4=1.2.3.4 [ +#foo.bar=2015 ]')
self.eq((1325376000000, 1420070400001), nodes[0].getTag('foo.bar'))

nodeedits = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this tested applying node edits and showing that the results of applying edits without changes resulted in a empty set of changes. I guess this would be OBE with the sode format change.

@@ -1,1493 +0,0 @@
import os
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to remove the associated documentation for this tool.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so there is additional clean up for doing that and ensuring that we have links back to the the v2.8.0 docs in place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants