[halo-dev/halo]docker-compose部署后第一篇文章,访问文章特别慢,图片已经用了云存储,请高手指点下吧,

2024-01-08 703 views
4
是什么版本出现了此问题?

2.1.0

使用的什么数据库?

MySQL 8.x

使用的哪种方式部署?

Docker Compose

在线站点地址

https://yanglu.10691.cn/archives/1673500130106

发生了什么?

配置上七牛云云存储之后,第一篇文章,浏览就特别卡,特别慢

相关日志输出
2023-01-12T14:59:47.936+08:00 ERROR 7 --- [-netty-thread-2] reactor.core.publisher.Operators         : Operator called default onErrorDropped

java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.ArrayList.<init>(Unknown Source) ~[na:na]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readCollectionOrArray(MappingR2dbcConverter.java:220) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readValue(MappingR2dbcConverter.java:192) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readFrom(MappingR2dbcConverter.java:176) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:130) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:113) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.EntityRowMapper.apply(EntityRowMapper.java:42) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.EntityRowMapper.apply(EntityRowMapper.java:29) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at com.github.jasync.r2dbc.mysql.JasyncResult.map$lambda-1(JasyncResult.kt:40) ~[jasync-r2dbc-mysql-2.1.7.jar:na]
        at com.github.jasync.r2dbc.mysql.JasyncResult$$Lambda$1747/0x00000008014a9b78.apply(Unknown Source) ~[na:na]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:964) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.Flux.subscribe(Flux.java:8660) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerNext(FluxConcatMapNoPrefetch.java:258) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:863) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:120) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:64) ~[reactor-core-3.5.1.jar:3.5.1]
        at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source) ~[na:na]

2023-01-12T14:59:47.937+08:00  WARN 7 --- [-netty-thread-2] reactor.core.Exceptions                  : throwIfFatal detected a jvm fatal exception, which is thrown and logged below:

java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.ArrayList.<init>(Unknown Source) ~[na:na]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readCollectionOrArray(MappingR2dbcConverter.java:220) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readValue(MappingR2dbcConverter.java:192) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readFrom(MappingR2dbcConverter.java:176) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:130) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:113) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.EntityRowMapper.apply(EntityRowMapper.java:42) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at org.springframework.data.r2dbc.convert.EntityRowMapper.apply(EntityRowMapper.java:29) ~[spring-data-r2dbc-3.0.0.jar:3.0.0]
        at com.github.jasync.r2dbc.mysql.JasyncResult.map$lambda-1(JasyncResult.kt:40) ~[jasync-r2dbc-mysql-2.1.7.jar:na]
        at com.github.jasync.r2dbc.mysql.JasyncResult$$Lambda$1747/0x00000008014a9b78.apply(Unknown Source) ~[na:na]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:964) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.Flux.subscribe(Flux.java:8660) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerNext(FluxConcatMapNoPrefetch.java:258) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:863) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:120) ~[reactor-core-3.5.1.jar:3.5.1]
        at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:64) ~[reactor-core-3.5.1.jar:3.5.1]
        at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source) ~[na:na]
附加信息

1

回答

7

4核8G

9

每次打开文章页时,cpu能跑满

1

你写文章的时候是否有直接在编辑器粘贴过图片的操作呢

5

@guqing 有过,我发现了这个问题,后台我将图片全部替换成云存储了,依然没改善

9

这个太不合理了,正常cms逻辑基本上复制图片自动上传默认存储路径下才对 @guqing

5

是的,我们会逐步解决这些问题,此问题有以下几个因素导致:

  1. 为了足够的扩展性,表结构只有一张,见 extension rfc, 所以保证查询速度需要在代码层面做的更多。
  2. 在编辑器拖拽或复制上传图片时没有支持上传到附件库,导致图片是 data blob 形式,内容很大。
  3. 文章具有版本管理机制但还没有提供用户界面让用户管理,所以即使更新了内容发布后依旧不会改动到旧的历史版本。
  4. 文章内存是根据首个发布版本增量保存,所以查询内容时需要获取第一个版本 patch 到当前版本得到内容,应该优化以减少文章 Snapshot 的 list 操作规避将大内容查询到内存。

我们会在 2.2.0 这个版本着重解决这些问题,尽量做到小数据量的使用速度并在后续版本迭代查询优化问题。

6

我还以为 系统坏了,看到内存占用和 单表,以为没有安装成功