V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yazinnnn0  ›  全部回复第 7 页 / 共 12 页
回复总数  223
1  2  3  4  5  6  7  8  9  10 ... 12  
148 天前
回复了 chenfang 创建的主题 程序员 服务器连接工具,求推荐
配置好~/.ssh/config 之后

ssh remote 登陆

sshfs remote:/remote/path /local/path 把远程文件系统挂载到本地
148 天前
回复了 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 内存
150 天前
回复了 catfly 创建的主题 程序员 开源项目被收购,为什么有些任这么酸?
如果是自由软件卖身成了专有软件, 那活该被酸
151 天前
回复了 magese 创建的主题 Java 有实际使用 SpringWebFlux 的大佬分享下经验吗?
不能平替

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

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

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

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

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

学 rust 对你找工作有帮助吗?
@erichen86 老哥握个手, 我是 5 年 2.6 万公里😂
156 天前
回复了 spitfireuptown 创建的主题 程序员 搞开源项目,收费卖文档有搞头吗
@L4Linux 不知道, 那 emacs 的操作手册是自由的文档吗?
156 天前
回复了 GDance 创建的主题 汽车 宝马 i3,好喜欢呀
极氪 007 23 万可以上到 100 度电池, 800 公里 cltc 续航

合资的新能源除了特斯拉外产品力都比不了国产车吧....
157 天前
回复了 spitfireuptown 创建的主题 程序员 搞开源项目,收费卖文档有搞头吗
貌似自由软件/开源软件祖宗 (自由软件基金会/fsf) 就有源代码自由, 文档/资料收费的发展史?



建议基础功能的文档公开, 高级/定制功能出书, 这样肯定不会挨骂了😘
157 天前
回复了 nrtEBH 创建的主题 Linux GNOME 下大家用什么中文字体
来点华康少女体
python 监听 domain socket, 开个 web server, 不算网络服务
想了解一下 http 短链接是咋实现代理 tcp 双工的🤨
161 天前
回复了 johnzr 创建的主题 职场话题 公司发的电脑
台式机 i5 10400 + 32G 内存, 装的 manjaro, 用了快 4 年了

自己手里的电脑, 两台 manjaro, 一白果一黑果
162 天前
回复了 darnurash 创建的主题 Java maven 怎么删除本地过时的依赖
rm -rf ~/.m2/repository/
162 天前
回复了 zuotun 创建的主题 Linux Windows 打游戏的方案是什么?
https://arch.icekylin.online/app/common/play.html#%F0%9F%9A%82-steam
1  2  3  4  5  6  7  8  9  10 ... 12  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2568 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms · UTC 14:27 · PVG 22:27 · LAX 07:27 · JFK 10:27
Developed with CodeLauncher
♥ Do have faith in what you're doing.