V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yazinnnn0  ›  全部回复第 6 页 / 共 11 页
回复总数  212
1  2  3  4  5  6  7  8  9  10 ... 11  
124 天前
回复了 37Y37 创建的主题 旅行 两年房车使用者劝你不要买房车
😎看看还行, 买是不会买的
服务器放国外不会被审查, 但是用的人多了会被墙

另外一个主要问题是没人会用
129 天前
回复了 movq 创建的主题 游戏 上班人有时间玩游戏么
没啥时间.... 结婚生子之后就更没有时间了
131 天前
回复了 weixind 创建的主题 程序员 有使用 MBA + mac studio 远程开发的方案吗?
你都远程了为啥还整个 mac studio ?
132 天前
回复了 erlo 创建的主题 职场话题 周会要表演个节目,救救孩子
唱国歌或者国际歌, 国际歌效果更好
😅只有京东 plus 会员, 给泥潭拖后腿了
@xmumiffy #12 好家伙, 双十国庆是吧, 你这是想害死墨索李妮吗😅
134 天前
回复了 qinjiang 创建的主题 Vue.js 2024 前端圈开年之战
尤主动索敌?
135 天前
回复了 chenfang 创建的主题 程序员 服务器连接工具,求推荐
配置好~/.ssh/config 之后

ssh remote 登陆

sshfs remote:/remote/path /local/path 把远程文件系统挂载到本地
135 天前
回复了 chenfang 创建的主题 程序员 服务器连接工具,求推荐
openssh 和 sshfs 不行吗?
@yazinnnn0 #72 看起来 quarkus 给 20m 就可以跑个基本的 crud 程序了

话说在资源敏感的情况下, 不是该上 rust 吗?
怼上数据库(postgres)后简单模拟了一下 quarkus 在有限内存的情况

implementation("io.quarkus:quarkus-hibernate-reactive")
implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
implementation("io.quarkus:quarkus-hibernate-reactive-panache-kotlin")
implementation("io.quarkus:quarkus-kotlin")
implementation("io.quarkus:quarkus-reactive-pg-client")


@Entity
class Todo : PanacheEntity() {
companion object : PanacheCompanion<Todo>

var title: String? = null
var description: String? = null
var completed: Boolean? = null

@Column(name = "due_date")
var dueDate: LocalDate? = null

@Column(name = "created_at", updatable = false)
var createdAt: LocalDate? = null

@Column(name = "updated_at")
var updatedAt: LocalDate? = null
}

@Path("todo")
class TodoApi {
@GET
fun getAll() = Todo.listAll()

@POST
fun save(todo: Todo): Uni<Todo> {
if (todo.id == null) {
return todo.persistAndFlush<Todo>()
}
throw WebApplicationException("id shouldn't exist", 499)
}

@GET
@Path("{id}")
fun getOne(@RestPath id: Long) = Todo.findById(id)
}


version: '3.8'

services:
postgres:
deploy:
resources:
limits:
memory: 100m
cpus: "0.1"
image: postgres:latest
environment:
POSTGRES_DB: yazinnnn
POSTGRES_USER: yazinnnn
POSTGRES_PASSWORD: yazinnnn

sample:
image: yazi/sample:1.0
deploy:
resources:
limits:
memory: 20m
cpus: "0.1"
ports:
- "80:8080"
depends_on:
- postgres
environment:
"QUARKUS_DATASOURCE_REACTIVE_URL": vertx-reactive:postgresql://postgres/yazinnnn


➜ postgres wrk -t 12 -c 100 -d 10s http://localhost/todo 18:09:49
Running 10s test @ http://localhost/todo
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 536.18ms 143.86ms 999.36ms 75.14%
Req/Sec 16.39 10.27 80.00 71.69%
1750 requests in 10.09s, 3.31MB read
Requests/sec: 173.39
Transfer/sec: 335.78KB


➜ postgres wrk -t 12 -c 100 -d 10s http://localhost/todo/1 18:10:03
Running 10s test @ http://localhost/todo/1
12 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 256.09ms 78.20ms 499.31ms 84.83%
Req/Sec 31.49 17.98 191.00 60.73%
3686 requests in 10.08s, 705.52KB read
Requests/sec: 365.55
Transfer/sec: 69.97KB
要不试试 quarkus?

docker run --cpus=0.1 --memory=20m --name quarkus -p 80:8080 yazi/sample:1.0
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2024-01-04 08:46:58,037 INFO [io.quarkus] (main) sample 1.0 native (powered by Quarkus 3.6.4) started in 0.284s. Listening on: http://0.0.0.0:8080
2024-01-04 08:46:58,037 INFO [io.quarkus] (main) Profile prod activated.
2024-01-04 08:46:58,037 INFO [io.quarkus] (main) Installed features: [cdi, hibernate-orm, hibernate-reactive, kotlin, reactive-pg-client, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vertx]


CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
185ccb037e19 quarkus 0.00% 12.16MiB / 20MiB 60.80% 993kB / 1.55MB 0B / 0B 42

yazinnnn0@cs-679368844937-default ~ [SIGINT]> wrk -t4 -d1s -c100 http://localhost:80/hello
Running 1s test @ http://localhost:80/hello
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 127.19ms 114.59ms 430.17ms 55.63%
Req/Sec 234.82 160.64 0.87k 78.57%
765 requests in 1.01s, 79.94KB read
Requests/sec: 755.88
Transfer/sec: 78.98KB


简单试了下 demo, 容器可以给 20M 内存
137 天前
回复了 catfly 创建的主题 程序员 开源项目被收购,为什么有些任这么酸?
如果是自由软件卖身成了专有软件, 那活该被酸
138 天前
回复了 magese 创建的主题 Java 有实际使用 SpringWebFlux 的大佬分享下经验吗?
不能平替

优势是并发量大, 消耗资源少, 功能强大

劣势是编程模型复杂, 复杂点的业务你要写成 monad 地狱, 虽然并发量大,但是一般业务瓶颈在数据库, 利用不到 reactive 的最大优势

写着玩可以随便试, 用 kotlin 协程可以稍微拯救一下 monad 地狱

loom 也不是银弹, loom 是增强 blocking 的方案, 不是增强 reactive 的方案
如果作为兴趣研究的话, 研究型语言推荐 scheme/racket/haskell, 工程型语言推荐 clojure 和 fsharp

都是最潮最 in 的函数式语言
kotlin 已经接近什么都可以干了, 正在向.net 应用场景全面靠拢

学 rust 对你找工作有帮助吗?
@erichen86 老哥握个手, 我是 5 年 2.6 万公里😂
143 天前
回复了 spitfireuptown 创建的主题 程序员 搞开源项目,收费卖文档有搞头吗
@L4Linux 不知道, 那 emacs 的操作手册是自由的文档吗?
1  2  3  4  5  6  7  8  9  10 ... 11  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   874 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms · UTC 22:22 · PVG 06:22 · LAX 15:22 · JFK 18:22
Developed with CodeLauncher
♥ Do have faith in what you're doing.