在JVM中标识组件的内存(Identifing components' memory in the JVM)
我们有一些团队在一个JVM中运行服务器组件。
当出现内存问题时,我们需要知道每个组件已经占用了多少内存(或者应该归咎于
OOME
:-))。是否有任何通用技术可以帮助识别每个组件的内存使用情况?
我知道内存转储及其分析工具,但有些情况下由于复杂的图形等原因,分析非常复杂。 我想知道是否有一些先进的技术,如私有堆或监控每个组件内存的有效方法。
We have a few teams running server components in one JVM.
When a memory issue arises, we need to know how much memory each component has taken (or who is to blame for the
OOME
:-) ).Is there any general technique that can help identify each component's memory usage?
I'm aware of memory dumps and their analysis tools, but there are cases where the analysis is very complex because of complex graphs and such. I was wondering if there are some advanced techniques like private heaps or efficient way to monitor each component memory.
原文:https://stackoverflow.com/questions/36461075
最满意答案
你接近这个的方式是不对的。 使用java时间模块的要点是解析作为ISO标准的json字符串。
你拥有的字符串是你不使用java时间模块时得到的json,它主要用于字符串化所有成员字段和getter。
因为所有的java时间类都是不可变的,所以jackson不会被取消。
因此,为了继续使用非标准的json,你甚至不需要一个java时间模块。 您可能必须编写自定义deserailizer并从json字段重新创建LocalDate,LocalTime和ZoneOffset,并使用静态OffsetDateTime.of(LocalDate,LocalTime,ZoneOffset)来创建OffsetDateTime。
The way you're approaching this is not right. The point of using java time module was to parse the json string which is a ISO standard.
The string that you have is the json that you get when you don't use java time module, which is essentially to stringify all the member fields and getters.
As all the java time classes are immutable the jackson will not be deserailize.
So to keep using the non standard json you dont even need a java time module. You may have to write a custom deserailizer and recreate the LocalDate, LocalTime and ZoneOffset from the json fields and use the static OffsetDateTime.of(LocalDate, LocalTime, ZoneOffset) to create the OffsetDateTime.
相关问答
更多-
是的,它可以在没有自定义串行器的情况下序列化POJO。 但在你的情况下,问题是你的所有属性都是“隐藏的”。 默认情况下,Jackson会寻找: 公共字段和getter(getXxx()) Setter(setXxx())的任何可见性 为了让杰克逊使用私人领域,您可以使用@JsonProperty对他们进行注释,或者更改默认的可见性检查级别,如果您希望找到所有私人(或受保护的包)可见的领域。 这可以通过注释(@JsonAutoDetect)或通过定义全局可见性检查器来完成。 I had a problem w ...
-
您无需为JSR-310类型编写自定义串行器和解串器。 杰克逊有一个自定义模块来处理这个问题,并为您提供所需的串行 器和解串器 。 首先将jackson-datatype-jsr310工件添加到您的依赖项中:
com.fasterxml.jackson.datatype jackson-datatype-jsr310 2.9 如何使用ObjectMapper Jackson反序列化泛型类型(How to deserialize a generic type with ObjectMapper Jackson)[2022-09-14]
我终于想出了一个解决方案,这里是: public staticList getList(String url, Class clazz) { HttpClient client = HttpClientBuilder.create().build(); HttpGet getRequest = new HttpGet(url); getRequest.setHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSO ... 这是偏移零缺失的问题,即8:30而不是08:30 。 显然DateTimeFormatter#ISO_OFFSET_DATE_TIME对此非常严格。 我检查了所有3个java.time.format.ResolverStyle ,当没有前导零时没有工作。 您认为ResolverStyle.LENIENT或ResolverStyle.SMART可以在ResolverStyle.STRICT失败时工作,但是nops。 感谢Jackson开发团队的工作人员。 This was an issue with a mi ...将Object Mapper更改为此选项可禁用ADJUST_DATES_TO_CONTEXT_TIME_ZONE。 objectMapper = Jackson2ObjectMapperBuilder.json() .modules(new JavaTimeModule()) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, DeserializationFeature.ADJ ...Jackson ObjectMapper反序列化OffsetDateTime - 非弹簧(Jackson ObjectMapper deserialize OffsetDateTime - non spring)[2022-03-08]
你接近这个的方式是不对的。 使用java时间模块的要点是解析作为ISO标准的json字符串。 你拥有的字符串是你不使用java时间模块时得到的json,它主要用于字符串化所有成员字段和getter。 因为所有的java时间类都是不可变的,所以jackson不会被取消。 因此,为了继续使用非标准的json,你甚至不需要一个java时间模块。 您可能必须编写自定义deserailizer并从json字段重新创建LocalDate,LocalTime和ZoneOffset,并使用静态OffsetDateTime. ...将ObjectMapper注入Spring Kafka序列化器/反序列化器(Inject ObjectMapper into Spring Kafka serialiser/deserialiser)[2022-12-03]
您可以将JsonSerializer和JsonDeserializer配置为@Bean 。 为它们注入所需的ObjectMapper 。 并在DefaultKafkaProducerFactory和DefaultKafkaConsumerFactory bean定义中使用这些bean: @Bean public ProducerFactoryproducerFactory() { DefaultKafkaProducerFactory 这是一个为Joda Money类型注册序列化器和反序列化器的示例。 所有Money对象都转换为JSON字符串。 public class JacksonJodaMoney { public static class Product { public final Money price; @JsonCreator public Product(@JsonProperty("price") Money price) { this ...Spring Boot如何配置我的Jackson ObjectMapper?(How is Spring Boot configuring my Jackson ObjectMapper here?)[2023-06-15]
SpringBoot自己实例化ObjectMapper,因为Spring将Java对象转换为JSON,反之亦然。 所以如果它在类路径中找到Spring引导,它将加载objectMapper。 现在在configureJackson方法中,您已经引用了ObjectMapper和@Autowired注释,因此Spring将为此方法提供ObjectMapper的实例。 @Autowired注释正在做你所指的魔术。 @Autowired Fizz fizz(Buzz buzz) { new Fizz(buzz) ...注入objectMapper并将查询参数map转换为object解决了这个问题 @Slf4j @RestController class MyController { @Autowired private ObjectMapper objectMapper @GetMapping('/pojo') void getPojo(@RequestParam MapallRequestParams) { MyRequest request = objec ... 相关文章
更多- Solr JVM&运维
- 如何查看自己机器上的JVM的版本
- JDK,JRE,JVM区别与联系
- Storm JVM 参数优化
- 试用Hadoop JVM复用配置
- 远程监控JVM--VisualVM
- JTA 只能 在同一个 jvm中吗
- tomcat jvm垃圾回收时机,可以通过配置指定么?
- Hadoop启动时出现Unrecognized option: -jvm
- Spark - A Fault-Tolerant Abstraction for In-Memory Cluster Computing
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。