qrtt1 積分 0

這實在太銷魂了,而且 error messages 還看不出來。

koji 積分 0

阿對齁,他必須得讓 ThreadLocal 在 virtual thread 中行為像之前一樣,了解了。

IngramChen 積分 1 編輯於

他是說以前一定要寫 finally 去回溯/移除 自己放在 ThreadLocal 的變數,因為 Thread 多半有 pool,是大家共用的。

之後用 virtual thread 就沒人在共用了,所以 ThreadLocal 不用怕碰到別人塞的值,也不用 finally 去處理。

而你講的 sharing 是該 thread 被用的當下,很多人都想塞變數,這個的確沒變,要靠 Scope Variable 的結構減少忘記互蓋的問題。

koji 積分 1 編輯於

比較在意 ThreadLocal 關聯的應用場景..

Scope Variables1

var oldValue = myTL.get();
myTL.set(newValue);
try {
  ...
} finally {
  myTL.set(oldValue);
}

Without this imposed structure, when a thread is shared among multiple tasks, one task’s TL values might leak into another. Virtual threads solve that problem by being lightweight enough to not require sharing.

沒看懂,為何 lightweight 就不用 sharing.

IngramChen 積分 0

6MB heap == 一百萬 virtual thread

sweet!

IngramChen 積分 0

對對,沒錯

jdbc 應該沒人會去開 thread

實例應該是從 tomcat 那層開始開 virtual thread 就好,app 通通不用動

koji 積分 1 編輯於
應該可以像這樣?
web request virtual thread->
      socket -> (virtually blocking)
      business logic ->
      jdbc request -> driver socket -> (virtually blocking)

除非是為了 structured concurrency,不然可以不用再自己看到一層 virtual thread?

等等來看看他的 EA 能不能玩

IngramChen 積分 0

Even basic control flow, like loops and try/catch, need to be reconstructed in “reactive” DSLs, some sporting classes with hundreds of methods.

RxJava 就是你

一個 class 有上百個 method 就是錯錯錯,沒什麼好說的

能夠寫正常的程式的話,誰要寫 reactive,誰要寫 async/await

Project Loom 走在正確的道路上,成功後就會換其他平台來學

IngramChen 積分 0

virtual thread 真是讓人興奮

所以 jdbc driver 都不用改自動就會變 virtual thread ?

  web request ->
      socket virtual thread -> (virtually blocking)
      business logic ->
      jdbc request ->
          driver socket virtual thread -> (virtually blocking)

然後在兩次的 virtual block 中,背後 OS thread 可能已經換過,或是沒變這樣?

koji 積分 0

你這樣一說害我一直注意到馬尾

Kros 積分 0

馬尾擺動還是沒辦法那麼真實

haocheng 積分 1

看起來是透過 plugin 來修改,頂多是預設有安裝但是關掉就好了

IngramChen 積分 0

讓 gradle 去跑 terraform 到是沒見過

IngramChen 積分 0

為什麼apache 特別愛用神話的梗咧

j0n 積分 1

Normally, a company may choose an API gateway or Nginx to mount multiple microservices, one for books, one for users, one for carts, etc. Or, they might wise up and use a monolith and put all 4 modules into one backend repository.

偷偷 diss 了一下 microservice XD

haocheng 積分 1

我就看過某家用 AWS Lambda 寫 API 的公司,有幾百個 Lambda 根本沒辦法維護...

IngramChen 積分 1

aws lambda 拿來寫 app server 累死自己