Solving Java Multithreading Challenges in My Google Photos Clone

  Рет қаралды 4,834

Marco Codes

Marco Codes

Күн бұрын

Пікірлер: 32
@KolosBros
@KolosBros Жыл бұрын
Marco, has anyone ever told You that You're doing absolutely fantastic stuff? Because You're doing absolutely amazing stuff
@MarcoCodes
@MarcoCodes Жыл бұрын
Jacek, thanks a lot for those words!! Much appreciated and a great start for the day for me.
@stephentomaszewski8501
@stephentomaszewski8501 Жыл бұрын
Please do a deep dive into optimizing the mutiprocessing. Most people don't understand the difference between threads and processes and how threads are light weight processes that share data, code, and the heap but have their own stack which makes context switching quicker.
@MarcoCodes
@MarcoCodes Жыл бұрын
Will see how/when to fit this in!
@tipazas
@tipazas Жыл бұрын
No need to say we want some content or not, from you it's interesting to see about everything :)
@marcinkunert
@marcinkunert Жыл бұрын
Awesome content as always. Thanks Marco!
@MarcoCodes
@MarcoCodes Жыл бұрын
Thank you!
@igeolasoji3513
@igeolasoji3513 Жыл бұрын
Hello Marco, I believe calling the parallel method before the other operators should work with the old Java version.
@MarcoCodes
@MarcoCodes Жыл бұрын
Hey Ige, nope, the order has no effect. As mentioned, it was a long known issue in the JDK, I'll need to dig around and find the openjdk bug report for this one.
@SergiyPonomarenko-f5e
@SergiyPonomarenko-f5e Жыл бұрын
Great as always!
@cdhagen
@cdhagen Жыл бұрын
16:25 Would be interesting to see how you solve the potential race condition when two threads work on identical files. I'm thinking about some kind of synchronized Set which stores the hashes of already processed images, maybe? 🤔
@MarcoCodes
@MarcoCodes Жыл бұрын
There are many ways to approach this. The easiest one I could think of for now is to let the two threads work on identical files, but render the resulting thumbnail to a randomly named tmpfile. And after rendering has finished, "mv" the tmp file into the final destination. If some other thread has already created the final file, then the mv will just be ignored, the file deleted and that's it. It's a simple solution without elaborated synchronisation on the Java side, just a bit of additional CPU wasted in this corner case.
@fmictsang8874
@fmictsang8874 9 ай бұрын
I learn a lot from this video.
@vishnugovindan8550
@vishnugovindan8550 Жыл бұрын
Hi Marco, any good resources on concurrent/multi threading programming in Java apart from concurrency in practice that you have found helpful?
@MarcoCodes
@MarcoCodes Жыл бұрын
Concurrency in practice is literally it. It's a bummer that there is no new version out, but reading/working through it will give you the best base possible. You also might want to follow up with the "little book of semaphores"
@rydmerlin
@rydmerlin Жыл бұрын
If ImageMagick was multithreaded would you want to see it using its own thread pool? Also can you say which NAS that you’re running Java on?
@MarcoCodes
@MarcoCodes Жыл бұрын
ImageMagick in fact already is multithreaded, and you can influence that behavior with command line options. Explaining what effect that has is a whole other topic :) as for the Nas, it is self-assembled and I don't quite remember the individual parts - it has been a couple years.
@tipazas
@tipazas Жыл бұрын
Just interested... what is the rationale behind strictly not using old File API? Performance? For me it looks like big price to have so much technical code copied instead of calling hasher.update(image.toFile()). Thank you.
@MarcoCodes
@MarcoCodes Жыл бұрын
That is a good question. It is just from past experience that I've seen the file API becoming cumbersome at some point, e.g. testing. And I got into the habit of making sure to use the Path API whenever I can - but sure, for the scope of that prototype we could have also used the "old" file API.
@AmNotLegend
@AmNotLegend Жыл бұрын
combine two filter in a private method
@MarcoCodes
@MarcoCodes Жыл бұрын
yup, possible.
@alirezaasadi8656
@alirezaasadi8656 8 ай бұрын
nothing new , most important question were not answered. you ask questions we are here for answers. that is actually a bad thing. we are here looking for the answers not questions. question already raised by ourselves.
@MarcoCodes
@MarcoCodes 8 ай бұрын
Ironically your nonsensical comment contains not a single question.
@marin1419
@marin1419 7 ай бұрын
@@MarcoCodes His prose follows the style of Gottlob Frege lmao
@cypherliquid
@cypherliquid Жыл бұрын
you are not going to continue this google photos clone
@MarcoCodes
@MarcoCodes Жыл бұрын
Why?
@cypherliquid
@cypherliquid Жыл бұрын
@@MarcoCodes common its 1st April you can't fall for this
@MarcoCodes
@MarcoCodes Жыл бұрын
I DID! :D Good one!
How To REALLY Do Code Reviews
23:34
Marco Codes
Рет қаралды 12 М.
I don't TDD. Writing Pragmatic Tests With Java.
28:25
Marco Codes
Рет қаралды 7 М.
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 72 МЛН
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 104 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 6 МЛН
How to Approach Java, Databases & SQL (for My Google Photos Clone)
31:18
Java multithreading 🧶
15:18
Bro Code
Рет қаралды 134 М.
Holly Cummins - Quarkus Efficiency Secrets
58:09
Quarkus Club
Рет қаралды 613
SSH Tutorial - Crash Course
29:43
Marco Codes
Рет қаралды 16 М.
Are You Using Java's Parallel Streams Correctly? - Java Programming
13:34
How to Build a Google Photos Clone in Java - Pilot
25:40
Marco Codes
Рет қаралды 10 М.
Multithreading in Java Explained in 10 Minutes
10:01
Coding with John
Рет қаралды 957 М.
How To Learn Any Programming Topic
18:14
Marco Codes
Рет қаралды 6 М.
How To Approach Dependency Management in Java
16:55
Marco Codes
Рет қаралды 7 М.
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 72 МЛН