Giter VIP home page Giter VIP logo

Comments (3)

Glavin001 avatar Glavin001 commented on June 5, 2024
  • store the count and total (and other stats) in a stats key:
  • store max and min
{
  timestamp_hour: ISODate("2013-10-10T23:00:00.000Z"),
  type: “memory_used”,
  values: [
    [ 999999, 999999, , 1000000 ],
    [ 2000000, 2000000, , 1000000 ],
    ,
    [ 1600000, 1200000, , 1100000 ],
    [ 1300000, 1400000, , 1500000 ]
  ],
  stats: [
    [ count, total, min, max], // Minute 0
    [ count, total, min, max], // Minute 1
    // ....
  ],
  count: 0,
  total: 0,
  min: 0,
  max: 0
}

from cobra.

Glavin001 avatar Glavin001 commented on June 5, 2024

Benchmarking

  • 1000 sensors per second.

Before (using subdocument schema)

image

After (using array schema)

  • Before implementing $max and $min

image

from cobra.

Glavin001 avatar Glavin001 commented on June 5, 2024

I notice that the min field is not getting set, because BSON comparison order puts null as less than a number. Instead of storing it in the order of [count, total, min, max], store it as [count, total, max, min] where min is empty by default, not null, such that on insert/default it is [0,0,0] for [count,total,max,min] and the $min update modifier will detect that the 3rd index is missing and initialize it with the minimum value.

from cobra.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.