ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

No encryption #393

Closed mixmix closed 1 year ago

mixmix commented 1 year ago

Problem: building a peer which doesn't do any encryption, but may want to publish things. Removing encryption reduces load on this peer (running on cheap droplet). The current code fails, even if you're not encrypting anything.

Solution: added a test case for minimal setup, and patched code to make it pass

github-actions[bot] commented 1 year ago

Benchmark results

Part Duration
Create 5000 new messages 384.97ms
Validate 5000 messages 480.33ms
Native to db format 5000 messages 125.62ms
Db to native format 5000 messages 83.76ms
Add 1000 elements 375.70ms
Add 1000 box1 msgs 1016.66ms
Unbox 1000 box1 msgs first run 228.17ms
Unbox 1000 box1 msgs second run 115.72ms
Add 1000 box1 msgs 975.89ms
Query 1000 msgs first run 43.53ms
Query 1000 msgs second run 12.64ms
Add 1000 box2 msgs 1310.03ms
Unbox 1000 box2 msgs first run 326.80ms
Unbox 1000 box2 msgs second run 147.87ms
Migrate (+db1) 11456.50ms
Migrate (alone) 3804.25ms
Migrate (+db1 +db2) 8441.87ms
Migrate (+db2) 5940.31ms
Migrate continuation (+db2) 931.45ms
Memory usage without indexes 749.07 MB = 38.33 MB + etc
Initial indexing 1590.85ms
Initial indexing maxcpu=86 5465.23ms
Initial indexing compat 742.17ms
Two indexes updating concurrently 2812.98ms
Key one initial 54.96ms
Key two 1.23ms
Key one again 0.97ms
Reboot and key one again 55.81ms
Latest root posts 1759.27ms
Latest posts 7.84ms
Votes one initial 1498.85ms
Votes again 0.59ms
HasRoot 1338.53ms
HasRoot again 0.35ms
Author one posts 1474.08ms
Author two posts 21.52ms
Dedicated author one posts 1507.66ms
Dedicated author one posts again 0.54ms
DeleteFeed 2797.66ms
Maximum memory usage 932.63 MB = 59.00 MB + etc
Indexes folder size 10.01mb
mixmix commented 1 year ago

That we commented choice I left there deliverately to show what had been deactivated. But sure

On Tue, 4 Oct 2022, 20:56 André Staltz, @.***> wrote:

@.**** requested changes on this pull request.

In test/minimal-db2.js https://github.com/ssbc/ssb-db2/pull/393#discussion_r986545407:

+const caps = require('ssb-caps') + +test('minimal db2 (no encryption)', t => {

  • const dir = '/tmp/ssb-db2-minimal-create'
  • rimraf.sync(dir)
  • const keys = ssbKeys.generate()
  • const stack = SecretStack({ appKey: caps.shs })
  • .use(require('../core'))
  • .use(require('ssb-classic'))
  • // .use(require('ssb-box'))
  • // .use(require('ssb-box2'))
  • // .use(require('../compat/publish'))
  • // .use(require('../compat/post'))
  • // .use(require('../migrate'))

Can you remove this commented code? And add a license header for this file (see how CI checks are failing).

That's my only feedback, otherwise looks good to merge and makes sense.

— Reply to this email directly, view it on GitHub https://github.com/ssbc/ssb-db2/pull/393#pullrequestreview-1129455644, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUK3HV4ZYVDFUXUFU5ZT7DWBPPK5ANCNFSM6AAAAAAQ37PECI . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 1 year ago

Benchmark results

Part Duration
Create 5000 new messages 366.30ms
Validate 5000 messages 443.00ms
Native to db format 5000 messages 119.21ms
Db to native format 5000 messages 88.20ms
Add 1000 elements 365.04ms
Add 1000 box1 msgs 922.89ms
Unbox 1000 box1 msgs first run 210.42ms
Unbox 1000 box1 msgs second run 109.78ms
Add 1000 box1 msgs 890.76ms
Query 1000 msgs first run 50.93ms
Query 1000 msgs second run 13.08ms
Add 1000 box2 msgs 1274.89ms
Unbox 1000 box2 msgs first run 322.01ms
Unbox 1000 box2 msgs second run 147.81ms
Migrate (+db1) 11706.37ms
Migrate (alone) 4122.68ms
Migrate (+db1 +db2) 8039.68ms
Migrate (+db2) 6230.25ms
Migrate continuation (+db2) 909.98ms
Memory usage without indexes 752.66 MB = 37.88 MB + etc
Initial indexing 1624.35ms
Initial indexing maxcpu=86 4999.38ms
Initial indexing compat 735.83ms
Two indexes updating concurrently 2766.76ms
Key one initial 46.65ms
Key two 1.09ms
Key one again 1.77ms
Reboot and key one again 39.92ms
Latest root posts 1745.46ms
Latest posts 9.36ms
Votes one initial 1434.32ms
Votes again 0.63ms
HasRoot 1279.93ms
HasRoot again 0.35ms
Author one posts 1379.82ms
Author two posts 14.96ms
Dedicated author one posts 1421.10ms
Dedicated author one posts again 0.51ms
DeleteFeed 3166.80ms
Maximum memory usage 1011.54 MB = 62.98 MB + etc
Indexes folder size 10.01mb
github-actions[bot] commented 1 year ago

Benchmark results

Part Duration
Create 5000 new messages 513.64ms
Validate 5000 messages 612.61ms
Native to db format 5000 messages 134.74ms
Db to native format 5000 messages 110.84ms
Add 1000 elements 532.35ms
Add 1000 box1 msgs 1303.28ms
Unbox 1000 box1 msgs first run 306.87ms
Unbox 1000 box1 msgs second run 149.49ms
Add 1000 box1 msgs 1239.58ms
Query 1000 msgs first run 45.52ms
Query 1000 msgs second run 16.19ms
Add 1000 box2 msgs 1883.32ms
Unbox 1000 box2 msgs first run 459.53ms
Unbox 1000 box2 msgs second run 212.52ms
Migrate (+db1) 15808.62ms
Migrate (alone) 5457.52ms
Migrate (+db1 +db2) 11900.79ms
Migrate (+db2) 7923.52ms
Migrate continuation (+db2) 1328.16ms
Memory usage without indexes 753.47 MB = 37.83 MB + etc
Initial indexing 2053.77ms
Initial indexing maxcpu=86 6435.13ms
Initial indexing compat 998.11ms
Two indexes updating concurrently 3682.65ms
Key one initial 69.06ms
Key two 0.57ms
Key one again 0.45ms
Reboot and key one again 56.15ms
Latest root posts 2276.98ms
Latest posts 9.91ms
Votes one initial 1932.29ms
Votes again 0.61ms
HasRoot 1747.01ms
HasRoot again 0.35ms
Author one posts 1774.33ms
Author two posts 20.17ms
Dedicated author one posts 1826.16ms
Dedicated author one posts again 0.76ms
DeleteFeed 3880.95ms
Maximum memory usage 978.17 MB = 54.92 MB + etc
Indexes folder size 10.01mb