Тёмный
Code Academia
Code Academia
Code Academia
Подписаться
Комментарии
@josipbjezancevic5697
@josipbjezancevic5697 2 месяца назад
1000 objects per batch for 100.000 objects in total in 3374.2938750000003ms, and using async transform with flush, no external dependencies.
@codeacademia
@codeacademia 2 месяца назад
Much better :) gg
@josipbjezancevic5697
@josipbjezancevic5697 2 месяца назад
@@codeacademia sorry, actually that was for 10000 objects per batch, for 1000 is around 4s. I wonder if we could do better. Which side represents a bottleneck - nodejs or mongodb inside the container. Also, I am running this on macbook pro with 32GB of memory and around 2Gs of memory for the container. I ran the mongostat inside the container to get some stats - I got around 31,073 inserts/sec.
@codeacademia
@codeacademia 2 месяца назад
31k per second is actually pretty descent for 1 cpu core. I can say there is room for improvement if you still haven't reached 100% of your CPU. You can split your data into multiple pieces and run multiple nodejs instances, each one reading from the data and inserting in MongoDb... At some point, you will need to scale your db and make it optimized for heavy write tasks as well!
@gustawdaniel
@gustawdaniel 4 месяца назад
I learned a lot from your videos. To solve problem with hanging script you could close mongo connection instead of process.exit.
@oussamahamdi8201
@oussamahamdi8201 4 месяца назад
i have an error on this line this.bigChart = this.dashboardService.bigChart(); : Type '{ name: string; data: number[]; }[]' is not assignable to type 'never[]'. Type '{ name: string; data: number[]; }' is not assignable to type 'never'.ts(2322)
@dhruvkumar-br2lp
@dhruvkumar-br2lp 8 месяцев назад
Amazing Content
@hamza201183
@hamza201183 8 месяцев назад
Thanks! Unfortunately, flex-layout is not maintained anymore.
@tenzl
@tenzl 9 месяцев назад
you said the high water mark is 16kB by default but at 2:39 you can see that the chunks are at least 65kB in size. whats going on here?
@codeacademia
@codeacademia 9 месяцев назад
Good catch, default highwatermark in nodejs streams is indeed 16Kb. You can double-check the documentation for that. The number of pipes influences the highwatermark as well as other factors, I'm not aware of it all, but i know from a fact that the size can change, and i let nodejs take care of it and adjust the speed by itself... There is no good/clear documentation about streams in general, so feel free to experiment things :) and make sure you share it with us :)
@Dsouza10082
@Dsouza10082 10 месяцев назад
Amazing, thank you !
@dg-cg5gi
@dg-cg5gi 10 месяцев назад
This doesn't work. The other pages just overlap the header. It acts like the header isn't part of the page. Very frustrating
@codeacademia
@codeacademia 10 месяцев назад
What angular version are you using? I've given you the github repository so you can take it as an example.
@progressnwimuelekara2167
@progressnwimuelekara2167 10 месяцев назад
I like the way you build the concepts from ground up.
@progressnwimuelekara2167
@progressnwimuelekara2167 10 месяцев назад
This is pure gold, man!
@codeacademia
@codeacademia 10 месяцев назад
Glad you liked it. Enjoy 😉
@jasonshen
@jasonshen 11 месяцев назад
nice tut question here, what if the master and slave is on a different server, if the master goes down, how does the slave become master gets its data from>?
@codeacademia
@codeacademia 11 месяцев назад
The master and slave are always in sync. The same data is shared between the slaves and the master. If the Master goes down, Sentienl switches the role of any slave he finds to become Master. If the Master that went down becomes up again, Sentienel will switch its role to Slave.
@jasonshen
@jasonshen 10 месяцев назад
@@codeacademia cheers for the answer, one issue here is, there is always a permission error, when sentinel trys to rewrite the config, not sure i you get that too, with the latest redis, i used your config to do the test but yeah in the sentinel container there is permission issues
@jasonshen
@jasonshen 10 месяцев назад
@@codeacademiaso basiclly it doesn't switch the slave to master if i take down the master
@codeacademia
@codeacademia 10 месяцев назад
Permission issues! What kind of permission? Could you share the issue?
@jasonshen
@jasonshen 10 месяцев назад
the fail over defiantly don't work with your configs @@codeacademia
@pritomkumarmondal9637
@pritomkumarmondal9637 Год назад
Great work
@codeacademia
@codeacademia Год назад
Thank you so much 😀
@manvirsingh2051
@manvirsingh2051 Год назад
Great tutorial, bless you ✨
@codeacademia
@codeacademia Год назад
Man thanks 😊
@kapssul
@kapssul Год назад
we ain't seeing a damn thing, you need to redo the recording.. zoom in the text..
@codeacademia
@codeacademia Год назад
Sorry about that
@Perissotojr
@Perissotojr Год назад
Save my life!
@AkshayGupta-dd4ht
@AkshayGupta-dd4ht Год назад
update ... in case slave can not connect to master due to protected issue - update this in both .conf "protected-mode no"
@syedhaiderali1519
@syedhaiderali1519 Год назад
Dude you are giving core concepts for free, hats off
@codeacademia
@codeacademia Год назад
My pleasure, part 2 and 3 have more interesting stuff as well :) Best of luck
@gopikaa3646
@gopikaa3646 Год назад
HI I need source code for this project
@codeacademia
@codeacademia Год назад
Its on github, check the description section.
@arindam1249
@arindam1249 Год назад
good intro
@asagiri_genkun
@asagiri_genkun Год назад
Hii, I'm very thankful for this easy to understand to the point video. But I'm referring to this video in now 2023 and did exact same code but somehow it is just showing blank webpage on Chrome. Any idea or solution to make it show up on screen. It will be very helpful.
@codeacademia
@codeacademia Год назад
Could you check in the console if there is any error? Hard to guess without a hint
@asagiri_genkun
@asagiri_genkun Год назад
@@codeacademia Hey.. Thanks for such quick response. There is actually no error at powershell, also I checked browser console there is none while landing on port but as soon I try to hit some endpoints manually (posts, login) in URL then error appears in console.
@codeacademia
@codeacademia Год назад
I see, what errors are you seeing? What angular version r u using?
@asagiri_genkun
@asagiri_genkun Год назад
@@codeacademia Hi..here is the list of packages and versions I'm using - - > Angular - 15.2.8 Angular CLI - 15.2.6 Node - 18.14.2 NPM - 9.5.1 OS - win32 x64 Angular flex-layout - 15.0.0-beta.42 (deprecated) [ I'm not quite sure if the error is related to this package being deprecated ] The error I'm getting on browser console is - - > NG0203: inject() must be called from an injection context.
@codeacademia
@codeacademia Год назад
That's the issue, I'm using angular 12 :( Can't help with that
@wulfhound2859
@wulfhound2859 Год назад
epic vid, even ChatGpt couldn't help me with the flex layout problem :D
@wryamhamad3781
@wryamhamad3781 Год назад
Thank you for sharing this tutorial but i have permission issue
@codeacademia
@codeacademia Год назад
Share the issue so i can help you
@wryamhamad3781
@wryamhamad3781 Год назад
@@codeacademia Thank you bro i was solve it one of issue is the redis version and second one is permisssion but i was solve them
@mugatu2017
@mugatu2017 Год назад
excellent video, really cool stuff
@codeacademia
@codeacademia Год назад
Thanks :)
@venu5791
@venu5791 Год назад
Great content . thank you very much 😊
@AshwaniKumar-zk1tg
@AshwaniKumar-zk1tg Год назад
how to save the data in csv format in the output file? Plzz help
@codeacademia
@codeacademia Год назад
Easy :) Instead of ndjson formatter that I've created, create another one for csv, and use createWriteStream to save it in a file. That's it.
@AshwaniKumar-zk1tg
@AshwaniKumar-zk1tg Год назад
@@codeacademia But it doesn't save the data in the desired format it saves the whole object in csv file
@codeacademia
@codeacademia Год назад
You should change the format by yourself. Use Something like Object.values(myObject).join(';') to create a csv, instead of objects use strings ... I can send a code that does that, but you need to learn a bit, experiment things :)
@AshwaniKumar-zk1tg
@AshwaniKumar-zk1tg Год назад
@@codeacademia Thnks i got the solution btw great series on node streams
@codeacademia
@codeacademia Год назад
Glad to hear that, please, like or share to support the channel 🙏
@bntheyoutube
@bntheyoutube Год назад
Wow!!! So helpful. Thank you!
@martynasjaraminas1831
@martynasjaraminas1831 Год назад
Hey, async pipeline works well on small amount of data (like 20 rows), but in this example if i have 400 lines it stops working and just hangs in processes (jest tests stat to crash due to timeout when i started migrating from pipe to pipeline). Any idea why this could happen? async function transformData() { const sourceFileStream = fs.createReadStream('fileName.json'); const resultStream = new PassThrough(); await pipeline(sourceFileStream, resultStream); return resultStream; }
@codeacademia
@codeacademia Год назад
Thanks for reaching out. Make sure that your last transform doesn't send any data. I've explained that in this tutorial, the last transform should behave like a write stream, its consums the data but doesn't send any.
@codeacademia
@codeacademia Год назад
Could you explain what you want to do? I don't understand what you want to do with PassThrough?
@martynasjaraminas1831
@martynasjaraminas1831 Год назад
@@codeacademia So my use case is reading remote file, transforming it and return it as readable stream, PassThrough or Transform can do that and does fine with small file. If i do not send any data returned stream is empty Here is example async function transformData() { const sourceFileStream = fs.createReadStream('fileName.json'); const resultStream = new PassThrough({ objectMode: true, transform(value, enc, cb) { cb(null); }, }); await pipeline(sourceFileStream, resultStream); return resultStream; } The problem is that original example works fine with small file but timesout on bigger one :S Originally i was using sourceFileStream.pipe(resultStream) And everything worked well
@codeacademia
@codeacademia Год назад
That has nothing to do the size of the file. Streams work great with huge files. For your use case use Transform not a PassThrough. And make sure to follow the requirements Await pipeline( yourReadStream, yourTransform, lastTransform) Make sure that LastTransform doesn't send any data in your callback. as explained in the videos :) Best of luck.
@martynasjaraminas1831
@martynasjaraminas1831 Год назад
@@codeacademia If anyone comes in with this question answer is highWaterMark, because node streams has protection and is build for piping information, it makes sense to have some limit of read data which is highWaterMark. In my case i needed to load all buffer in to the memory, which means i need to have high highWaterMark, which will impact application memory used but lets me pass streams around. Not suggesting to do this to anyone as for my case its bad architecture and legacy code :(
@adrianmarinv
@adrianmarinv Год назад
How do you check the progress (status) of a pipeline? With pipe you can use something like fs.statSync and then do str.on('progress'.... and console.log it But with pipeline this doesn't work.
@codeacademia
@codeacademia Год назад
I'm not aware of any pipeline status that can be applied.
@adrianmarinv
@adrianmarinv Год назад
@@codeacademia It would be helpful, especially for large files to check the progress of the stream.
@codeacademia
@codeacademia Год назад
Agreed, you can use a transform to keep track of "consumed" chunked divided by the total of chuck (objects or csv lines ...)
@ravigupta04
@ravigupta04 Год назад
how to convert ndjson file to avro file
@codeacademia
@codeacademia Год назад
Check avro-js
@riccardomarzo286
@riccardomarzo286 Год назад
Very very useful, thank you so much 4 sharing your know-how with us!!
@codeacademia
@codeacademia Год назад
Glad you liked it :)
@riccardomarzo286
@riccardomarzo286 Год назад
@@codeacademia 100% :)
@dilshad51
@dilshad51 Год назад
no clear video
@dilshad51
@dilshad51 Год назад
no clear video
@judegao7766
@judegao7766 Год назад
What happens when highWaterMark for the CSV stream is smaller than a single object, would our transform still work? In this case, it seems that each chunk exact matches a single object - is this behaviour implemented in the CsvToJson plugin?
@codeacademia
@codeacademia Год назад
CsvToJson takes care of it, yes. And yes, the transform will continue to work without problems :) I suggest leaving hightWaterMark in its default value.
@judegao7766
@judegao7766 Год назад
@@codeacademia how could it continue to work if the chunk you receive represents half of an object or more than one object.. because your transform function expects a single object as input and a single object as output. No?
@codeacademia
@codeacademia Год назад
Under the hood, csvToJson will make sure to send you an object. If it receives less or more, it will make sure to send you a valid object down the pipeline...
@mrlectus
@mrlectus Месяц назад
@@codeacademia Yeah i discovered that using fetch i have to JSON.parse(chunk.toString())
@Czarnyy45
@Czarnyy45 Год назад
How to transform data and save to .json not "ndjson" ?
@codeacademia
@codeacademia Год назад
Ndjson file is a simple file that contains multiple json object, that's it...
@GerardoMeridagt
@GerardoMeridagt Год назад
Great! thanks
@frontend_ko
@frontend_ko Год назад
watch all your videos, thanks. i'm using ffmpeg with spawn which is piped with one input readstream to stdin of spawn and three output writestream to stdio[3], stdio[4], stdio[5] of spawn. but i don't know how to pipe rs -> spawn -> 3 ws. how can i do it?
@salmanrana9478
@salmanrana9478 Год назад
Loved it bro
@codeacademia
@codeacademia Год назад
:)
@funzoneclub9094
@funzoneclub9094 Год назад
how we can use time node index.js script in window Is there any module or script
@codeacademia
@codeacademia Год назад
No idea :) i don't use Windows, and i don't recommend you to use it. I recommend using wsl 2 so you can use linu instead.
@dasten123
@dasten123 Год назад
I highly recommend to install "Git For Windows", it comes with a Linux-terminal emulator called Git-Bash. Having Git installed is always a good idea anyway, and with Git-Bash you can use most basic Linux commands, like "time" for example directly in Windows. That's what I do. I don't like to work from inside a virtual machine.
@olgan4224
@olgan4224 Год назад
Thank you fo great video on pipeline, very useful
@olgan4224
@olgan4224 Год назад
These awesome videos help me so much with my current task at my job! Thank you
@porcayomercadoarathramses4547
Hello friend can I make you a question, why the imports they don't work
@codeacademia
@codeacademia Год назад
What version are you using?
@khalidgamal9972
@khalidgamal9972 Год назад
Great, thank you man!
@tranminhhieu9492
@tranminhhieu9492 Год назад
Very clear tutorial
@rasmus5879
@rasmus5879 Год назад
Great video series!! Helped me a ton😊🙏
@codeacademia
@codeacademia Год назад
Glad it did :)
@serpilazman3971
@serpilazman3971 Год назад
Great sample for beginners.Thanks
@deepshikhaverma2358
@deepshikhaverma2358 Год назад
Thank you so much 💯👌👌👌👌
@edrim378
@edrim378 Год назад
Hi, thanks for this tutorial, but i have a problem at minute 35:33 because the property chartOptions: {}; on area.component.ts have the error: "Property 'chartOptions' has no initializer and is not definitely assigned in the constructor." can help to me? i used angular 14
@emad_arnesto9175
@emad_arnesto9175 2 года назад
please can u explain more abt this function applyFilter(event) bcs i can't understand parameter (event) and thank in advance
@codeacademia
@codeacademia 2 года назад
It depends on your Angular version. Angular 8 and below we need $event. Recent ones doesn't need it anymore, remove it and it will work
@leninvalen123
@leninvalen123 2 года назад
Awesome,go on like this bro .... thanks
@codeacademia
@codeacademia 2 года назад
I'm glad you liked it :)
@arielnenecastro
@arielnenecastro 2 года назад
Hello! Can someone help me out? after the first chart, the area one, i'm getting this error: src/app/shared/widgets/area/area.component.ts:11:3 - error TS2564: Property 'chartOptions' has no initializer and is not definitely assigned in the constructor. what have i missed?
@codeacademia
@codeacademia 2 года назад
That's why i gave you the github repository :) compare your code with mine if you need to :) Best of luck
@arielnenecastro
@arielnenecastro 2 года назад
@@codeacademia i found the problem. Some configurations at tsconfig.json. for some reason it was in strict model. I change mine for yours and it worked