Giter Site home page Giter Site logo

Comments (6)

lmachens avatar lmachens commented on September 9, 2024

This is a difficult question. My server has 1.5 GB memory and 2 cores. It runs a single mongo replica set and the apm server. After about 2 weeks the UI and aggregation is getting very slow. It helps to clean up the database (I don't need data older than 2 weeks, so it is fine for me).
I have 6 servers and 1 application with 200 to 500 users online at the same time. So there are a lot of data generated.
The big performance problem is the incremental aggregation which takes longer and longer after a while. Problems starts when the aggregations takes longer than the interval. I am sure that it is possible to handle it.

I would recommend to use at least two cores if you use a single server for the apm and database. Memory is not so important (500mb should be fine).

from meteor-apm-server.

markreid avatar markreid commented on September 9, 2024

I've got it running on a single core Lightsail instance and with more than about 2-3 weeks worth of data it becomes unusable because the aggregation methods are called faster than they can complete.

I saw your todo note to configure a timeout for pruning old data @lmachens, have you had a chance yet to look at exactly what the aggregation is doing and whether there's any optimisations to be made there? It seems odd that the entire historical data set needs to be crunched every X minutes...

from meteor-apm-server.

lmachens avatar lmachens commented on September 9, 2024

@markreid Yes, I know that problem. I think the best way is to optimize the query and indexes. The aggregation is incremental.

async function runAll() {
  await incrementalAggregation(PROFILES['1min'], PROVIDERS['errors']);
  await incrementalAggregation(PROFILES['1min'], PROVIDERS['methods']);
  await incrementalAggregation(PROFILES['1min'], PROVIDERS['pubsub']);
  await incrementalAggregation(PROFILES['1min'], PROVIDERS['system']);
  await incrementalAggregation(PROFILES['30min'], PROVIDERS['errors']);
  await incrementalAggregation(PROFILES['30min'], PROVIDERS['methods']);
  await incrementalAggregation(PROFILES['30min'], PROVIDERS['pubsub']);
  await incrementalAggregation(PROFILES['30min'], PROVIDERS['system']);
  await incrementalAggregation(PROFILES['3hour'], PROVIDERS['errors']);
  await incrementalAggregation(PROFILES['3hour'], PROVIDERS['methods']);
  await incrementalAggregation(PROFILES['3hour'], PROVIDERS['pubsub']);
  await incrementalAggregation(PROFILES['3hour'], PROVIDERS['system']);
}

Meteor.startup(() => {
  runAll();
  setInterval(runAll, 60000);
});

I think 1min depends on raw, 30min depends on 1min and 3hours depends on 30min.
The 1min should be fast, because the raw data is removed after the aggregation.

  if (SourceCollection === PROVIDER.rawCollection) {
    // Clean rawCollection
    PROVIDER.rawCollection.remove(query);
  }

I would take a deeper look to MapReduce(SourceCollection, DestCollection, PROVIDER.map, PROVIDER.reduce, options); and check if the mongo indexes makes sense. Maybe there is more data we can remove directly after the aggregation.

from meteor-apm-server.

lmachens avatar lmachens commented on September 9, 2024

I did some improvements to the indexes and cleanup.
In addition, you can set the maximum lifetime of metrics in the settings.json.
Example (default 7 days ^= 604800000) :
"metricsLifetime": 604800000

Please give me feedback if this changes makes the apm server more stable.

from meteor-apm-server.

cwohlman avatar cwohlman commented on September 9, 2024

The changes look good, I haven't been the server running long enough to detect issues.

from meteor-apm-server.

cwohlman avatar cwohlman commented on September 9, 2024

For what it's worth I've been running the server on a t2-micro for non-production loads (my app has fewer than 50 concurrent users) & it's working fine so far.

from meteor-apm-server.

Related Issues (20)

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.