Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
VagueRant
May 24, 2012
On an AWS lambda with 10gb of memory, I'm hitting the NodeJS heap limit trying to stream a 7mb file and output a 3.5mb file.

Running some garbage collection logs on my unit tests, but can't see anything unusual to indicate a memory leak. Even removing the streams and just loading data (smaller local files) into memory seems to make little difference.

Any advice on how to find where this is going wrong?

Adbot
ADBOT LOVES YOU

VagueRant
May 24, 2012
Losing my mind trying to understand a bit of syntax. My actual goal is turning it from an arrow function to a regular function declaration.

Technically using Typescript and the aws-embedded-metrics library if that gives any extra context.

code:
const publish = metricScope(metrics => async (input: ExampleObjType): Promise<MetricsLogger> => 
  metrics.someChainedFuncsThatPublishAMetric(input.exampleKey)
);

// Called as
publish({ exampleKey: 'example value' });
But to simplify, I'm clearly missing some key thing in my reading on how this is creating the 'metrics' value, and how I can turn it into a regular function:
code:
metricScope(metrics => async (input) => metrics.someChainedFuncs())

VagueRant
May 24, 2012
Unless I'm misunderstanding even more :smith:, we all seem to be forgetting the metricScope() func from the library, and the fact I'm not explicitly defining the 'metrics' value above any of the code?

To reference their docs:
TypeScript code:
const { metricScope, Unit, StorageResolution } = require("aws-embedded-metrics");

const myFunc = metricScope(metrics =>
  async (param1: string, param2: number) => {
    metrics.putDimensions({ Service: "Aggregator" });
    metrics.putMetric("ProcessingLatency", 100, Unit.Milliseconds, StorageResolution.Standard);
    metrics.putMetric("Memory.HeapUsed", 1600424.0, Unit.Bytes, StorageResolution.High);
    metrics.setProperty("RequestId", "422b1569-16f6-4a03-b8f0-fe3fd9b100f8");
    // ...
  });

await myFunc('myParam', 0);

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply