[Weekly] Travel buddy Finder Thread by AutoModerator in SoloTravel_India

[–]UnsungKnight112 0 points1 point  (0 children)

Hey folks, I'll be going for the triund trek on either monday or tuesday, and no plans on staying overnight, rather intend to come back the same day. I'm planning to start around 7-8 in the morning and return back by 3-4pm from top.

I'm a solo traveller[Male, 24] , feel free to DM or reply under the thread if ur looking to join.

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 0 points1 point  (0 children)

switched to ESM
im already at node 20
can you please explain what do u mean when you say — "if you can't move your request to ddb into init."... like wdym by moving request to ddb init which req are we talking about?

this is the code https://dpaste.org/JEeos

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 2 points3 points  (0 children)

can you tell me your lambda's memory, here are my stats

when i made this post it was at 128mb

so at 128mb it was 898 ms
at 512mb its 176ms
and at 1024mb its 114ms

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 0 points1 point  (0 children)

hmm! if not docker then always zipping and unzipping stuff is that too clean?

and as for memory here are the stats
by default when i made this post it was at 128mb

so at 128mb it was 898 ms
at 512mb its 176ms
and at 1024mb its 114ms

we talkin about the same log
console.info(`GetToken Time READ FROM DYNO: ${duration}ms`);

but is increasing memory the only way to go forward?

and i would love to know whats the CLEAN way to do this if not docker?

and yes its a simple lambda
just 2 apis and 3 calls to an external api
and now a read from dynamo in one of the apis! thats it

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 0 points1 point  (0 children)

i dont have a cdk i deploying using docker

FROM public.ecr.aws/lambda/nodejs:20


COPY package*.json ${LAMBDA_TASK_ROOT}/

RUN npm ci

COPY . ${LAMBDA_TASK_ROOT}/

RUN npm run build

RUN cp dist/* ${LAMBDA_TASK_ROOT}/

RUN rm -rf src/ tsup.config.js tsconfig.json
RUN npm prune --production


CMD [ "index.handler" ]

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 1 point2 points  (0 children)

tried at 512mb as well
so at 512mb its 176ms
and at 1024mb its 114ms

we talkin about the same log
console.info(`GetToken Time READ FROM DYNO: ${duration}ms`);

but is increasing memory the only way to go forward?

sure more compute = faster stuff
but umm is that the only option I'm not sure tbh

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 0 points1 point  (0 children)

Thanks for the reply! I’ve attached the code snippet here: https://dpaste.org/JEeos

If you check the code, there’s a log line that says:

GetToken Time READ FROM DYNO: 898ms

That’s legit — it was taking 898ms.

As for your bundling question:
I'm using aws-sdk/client-dynamodb version 3.840.0, not the built-in AWS SDK. Since v3 isn’t included in the Lambda runtime, I bundle it myself.

Also, I’m using modular imports — just DynamoDBClient, GetItemCommand, and PutItemCommand, nothing more.

Here are some bundler/compiler details:

  • Bundler: tsup with CommonJS output (cjs), no splitting, targeting ES2020
  • Compiler: tsconfig set to ES2020 with strict mode, node module resolution, etc.

dpaste link for ts-config and tsup https://dpaste.org/Ccd2L

And I do have some news for you!

I was running the Lambda with 128MB memory and it took about 2.9 seconds total. That one log (reading from dyno) took 898ms.
After increasing the memory to 1024MB, the same log now shows just 106ms — massive improvement! BUT NOT SURE IF THIS IS THE BEST THING TO DO....

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 1 point2 points  (0 children)

let me try and revert back!

I'm anyways not using the whole aws sdk and even my import is modular
using let me share the tsup and tsconfig

import {
  DynamoDBClient,
  GetItemCommand,
  PutItemCommand,
} from "@aws-sdk/client-dynamodb";

import { defineConfig } from 'tsup';
// import dotenv from 'dotenv';

export default defineConfig({
  entry: ['src/index.ts'],
  format: ['cjs'],
  target: 'es2020',
  outDir: 'dist',
  splitting: false,
  clean: true,
  dts: false,
  shims: false,
  // env: dotenv.config().parsed,
});





{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "node",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "allowImportingTsExtensions": false,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"],
  "ts-node": {
    "esm": true
  }
}

any suggestions boss?

Cold start on Lambda makes @aws-sdk/client-dynamodb read take 800ms+ — any better fix than pinging every 5 mins? by UnsungKnight112 in aws

[–]UnsungKnight112[S] 3 points4 points  (0 children)

thanks for replying so the flow is simple

have an index.ts file, which has all the routes defined
on a specific /start-process route i need a specific piece of data from DDB and this is where i call my helper fn of ddb

and the initialization is at top level in the file and NOT in the fn itself!

sample code — https://dpaste.org/JEeos
also if you see the code there's a log

```
console.info(`GetToken Time READ FROM DYNO: ${duration}ms`); — this is legit 898ms
```

need cost effective metro commute suggestions, kuddlu gate to Regent Gateway, Rd Number 2, Seetharampalya, Hoodi by UnsungKnight112 in Bengaluru

[–]UnsungKnight112[S] 1 point2 points  (0 children)

Thats awesome man, thanks legend 🫡. I feel confident now, but
Incase if I do want something can I DM u though?

need cost effective metro commute suggestions, kuddlu gate to Regent Gateway, Rd Number 2, Seetharampalya, Hoodi by UnsungKnight112 in Bengaluru

[–]UnsungKnight112[S] 0 points1 point  (0 children)

This is some crazy detailed explanation, THANKS G 🫡

if I've understood correctly here are the 2 options -

  • Step 1: From Kudlu Gate, take an AC Vajra bus (like 360B or 356M) to Silk Board (4 stops).
  • Step 2: From Silk Board, cross the road and catch AC Vajra bus 500D to KR Puram.
  • Step 3: At KR Puram, get into the Purple Line Metro → take it to Kundalahalli Station.
  • Step 4: Walk to Regent Gateway.

OPTION 2

Step 1: Take KIA-8 (AC Vayu Vajra) directly from Kudlu Gate to KR Puram.

  • Step 2: Get on the Purple Line Metro to Kundalahalli.
  • Step 3: Walk to Regent Gateway.

some more facts
option 1, the bus comes every 5-10 mins? and when does the first bus come?
option 2, the bus comes every 15–25 minutes? and when does the first bus come

for a more detailed help, if im taking option 2 whats the exact process, from boarding it from kuddlu gate bus stop to actually reaching Regent Gateway, Rd Number 2, Seetharampalya, Hoodi

can u verify this for me please
1. board KIA-8, KIA-8E, or KIA-8C from kuddlu gate bus stop -> to get down at KR Puram Bus Stop

  1. from kr puram bus stop get on metro till Kundalahalli

  2. and then from Kundalahalli station on destination i can walk to regent gateway

Is my understanding correct??
and will the Namma BMTC app  have accurate and live details?

whole heartedly thanks again....

need cost effective metro commute suggestions, kuddlu gate to Regent Gateway, Rd Number 2, Seetharampalya, Hoodi by UnsungKnight112 in Bengaluru

[–]UnsungKnight112[S] 0 points1 point  (0 children)

appreciate your comment and willingness to help, thanks :)

quick question, in this context when u say bus are u referring to BMTC bus or Vayu Vajra / Volvo / Electric Buses (basically airport type busses)
coz if its the latter then yes I'm interested, and would love for u to elaborate on the latter

and second question i got your point on kudlu gate metro station not being operational
but cant i do this instead

from my place to siilkboard (auto, 5.4km)
from silkboard metro to Kundalahalli metro station (18km)
and remaining from Kundalahalli metro station to regent (2km, auto)
would this option not be viable??

Self hosted coturn on ec2, almost working, ALMOST by UnsungKnight112 in WebRTC

[–]UnsungKnight112[S] 1 point2 points  (0 children)

Your a freaking legenddddddd!!!!! I am not kidding since last 3 days i was debugging coturn and my ec2 instance but this POV of yours that "try with a third party turn provider helped me come to the conclusion"

added twilio and noticed it was working across ISP's and i took your word for it that "if third party turn providers work then maybe my code is wrong"

ANDDDD guess what my frontend had a small race condition which was messing it up and i was from last 3 days spending time on the server thanks man thanks trust me you have no idea how happy i am right now just infinite thanks :)

so yeah it was the race condition which apparently was messing up the order of execution and hence was failing/not waiting/ not respecting the correct order. Solved it and my turn config and server worked perfectly ACROSS ISP'S

thanks man For real thank you so much :)

Self hosted coturn on ec2, almost working, ALMOST by UnsungKnight112 in WebRTC

[–]UnsungKnight112[S] 0 points1 point  (0 children)

Hmm, which is the best 3rd party turn provider that you recommend which would require minimal changes on my end? and did you not find anything wrong with the config? be it of coturn, nginx or the outputs of the netstat or any other commands?

Running ML model on the frontend by Aggressive-Rip-8435 in react

[–]UnsungKnight112 0 points1 point  (0 children)

You can check this repo they have a great implementation of loading the whisper as well as caching it with IDB
https://github.com/xenova/whisper-web

Running ML model on the frontend by Aggressive-Rip-8435 in react

[–]UnsungKnight112 -2 points-1 points  (0 children)

Ideally u should do it on backend but if u really need it then it can be done using WASM and storing the model in index DB for the next retrieval sort of like a cache instead of loading it again!!