mica 1.1.7 发布 mica-http 毕业从 http 到轻量级爬虫

mica(云母)

mica 云母,寓意为云服务的核心,增强 Spring cloud 功能,使得 Spring cloud 服务开发更加方便快捷。

mica 核心依赖

mica 基于 java 8,没有历史包袱,支持传统 Servlet 和 Reactive(webflux)。采用 mica-auto 自动生成 spring.factories 和 spring-devtools.properties 配置,仅依赖 Spring boot、Spring cloud 全家桶,无第三方依赖。市面上鲜有的微服务核心组件。

依赖 版本
Spring 5.x
Spring Boot 2.1.x
Spring Cloud Greenwich 版

更新说明

  • :zap: 优化 readme 添加文档地址.
  • :zap: 添加 .codacy.yml 配置.
  • :zap: 添加模块 mica-laytpl 模块.
  • :zap: mica-core 增强 XmlHelper 支持安全和非安全模式.
  • :zap: mica-http html、xml 转 Bean,并支持类型转换.
  • :zap: mica-http 添加重试机制.
  • :zap: mica-http add EventListener。
  • :zap: mica-http 优化拦截器,支持多个,将日志拦截器放到最后。
  • :zap: gradle use platform replace enforcedPlatform。
  • :zap: mica-cloud 优化 RestTemplate Bean 添加配置开关,默认不开启.
  • :arrow_up: 依赖升级 swagger-bootstrap-ui 到 1.9.5.

1. 介绍

​ mica-http 自从 v1.1.3 加入到 mica 最近几周一直在打磨,逐渐成为了一个轻量级爬虫工具。

2. 爬虫代理和重试

mica 1.1.7 发布 mica-http 毕业从 http 到轻量级爬虫

3. 爬取页面

mica 1.1.7 发布 mica-http 毕业从 http 到轻量级爬虫

4. 模型

mica 1.1.7 发布 mica-http 毕业从 http 到轻量级爬虫

mica 1.1.7 发布 mica-http 毕业从 http 到轻量级爬虫

5. 压测报告

第一轮

Benchmark                           Mode  Cnt    Score     Error    Units
MicaHttpBenchmark.micaHttp         thrpt    5  899.299 ± 208.080  ops/min
MicaHttpBenchmark.okHttp           thrpt    5  841.669 ± 106.094  ops/min
MicaHttpBenchmark.protoTypeOkHttp  thrpt    5  346.647 ±  23.664  ops/min

第二轮

Benchmark                           Mode  Cnt    Score     Error    Units
MicaHttpBenchmark.micaHttp         thrpt    5  876.651 ± 276.569  ops/min
MicaHttpBenchmark.okHttp           thrpt    5  899.365 ± 194.188  ops/min
MicaHttpBenchmark.protoTypeOkHttp  thrpt    5  341.028 ±  34.713  ops/min

第三轮

Benchmark                           Mode  Cnt    Score     Error    Units
MicaHttpBenchmark.micaHttp         thrpt    5  944.017 ± 175.509  ops/min
MicaHttpBenchmark.okHttp           thrpt    5  875.143 ± 164.594  ops/min
MicaHttpBenchmark.protoTypeOkHttp  thrpt    5  331.370 ±  19.136  ops/min

解读

  • mica-http 对 okhttp 进行增强,并没有明显的性能损耗,偶尔结果还比 okhttp 表现得好。
  • protoTypeOkHttp 采用的是每次 new OkHttpClient() 性能损耗明显非常明显,而且高并发下还有内存泄露,所以大家在使用时一定要注意。

文档

欢迎关注我们的公众号:如梦技术,精彩内容每日推送。

上一篇:linu前台和后台进程说明


下一篇:自定义 ForkJoinPool 提升并行流 ParallelStream 执行速度