动力节点-SpringBoot3-第九章了解AOT和GraalVM

Java AOT之GraalVM native image介绍以及简单长连接服务实践 Java语言有20多年的发展历史,拥有众多优秀的特性如面向对象、安全、解释性、平台无关等,该语言以及其强大的生态使其成为最重要的网络编程语言。但是随着近年来技术架构的发展,微服务逐渐趋向云原生及Serverless化,使得Java也面临如下挑战:启动缓慢、内存占用大、预热问题。 Java服务启动时首先要启动一个JVM虚拟机,然后虚拟机会加载字节码,中间还包括类的加载解析初始化。JVM运行字节码运行时有解释执行和编译两种执行方式:当系统刚启动时,JVM会以解释执行并检测热点代码,热点代码会通过c1c2编译器 阅读详情

9.1 提供性能的技术

什么是AOT:
Ahead-of-Time Compilation :预编译(提前编译)它在 JEP-295 中描述,并在 Java 9 中作为实验性功能添加。
AOT是提升Java程序性能的一种方法,特别是提供JVM的启动时间。在启动虚拟机之前,将Java类编译为本机代码。改进小型和大型Java应用程序的启动时间。

JIT (just in time):
JIT是现在JVM提高执行速度的技术,JVM执行Java字节码,并将经常执行的代码编译为本机代码。这称为实时 (JIT) 编译。
当JVM发现某个方法或代码块运行特别频繁的时候,就会认为这是“热点代码”(Hot Spot Code)。然后JIT会把“热点代码”编译成本地机器相关的机器码,并进行优化,然后再把编译后的机器码缓存起来,以备下次使用。
JVM 根据执行期间收集的分析信息决定 JIT 编译哪些代码。JIT编译器速度很快,但是Java程序非常大,以至于JIT需要很长时间才能完全预热。不经常使用的Java方法可能根本不会被编译。

特点:在程序执行时,边运行代码边编译。JIT编译需要时间开销,空间开销,只有对执行频繁的代码才值得编译。

AOT:静态的
JIT:动态的

9.2 Native Image

native image: 原生镜像(本机镜像)

native image is a technology to ahead-of-time compile Java code to a standalone executable, called a native image
本机映像是一种预先将Java代码编译为独立可执行文件的技术,称为本机映像(原生镜像)。镜像是用于执行的文件。
通过镜像构建技术(工具)生成镜像文件(native image)。
native

AOT概述 11.1.1、JIT与AOT的区别JIT和AOT 这个名词是指两种不同的编译方式,这两种编译方式的主要区别在于是否在“运行时”进行编译(1)JIT, Just-in-time,动态(即时)编译,边运行边编译;在程序运行时,根据算法计算出热点代码,然后进行 JIT 实时编译,这种方式吞吐量高,有运行时性能加成,可以跑得更快,并可以做到动态生成代码等,但是相对启动速度较慢,并需要一定时间和调用频率才能触发 JIT 的分层机制。JIT 缺点就是编译需要占用运行时资源,会导致进程卡顿。 阅读详情

相关推荐

动力节点-SpringBoot3第九章了解AOT和GraalVM

Ahead-of-Time Compilation :预编译(提前编译)它在 JEP-295 中描述,并在 Java 9 中作为实验性功能添加。AOT是提升Java程序性能的一种方法,特别是提供JVM的启动时间。在启动虚拟机之前,将Java类编译为本机代码。改进小型和大型Java应用程序的启动时间。

Javanewspaper的博客 922

动力节点SpringBoot3笔记⑨了解AOT和GraalVM

Ahead-of-Time Compilation :预编译(提前编译)它在 JEP-295 中描述,并在 Java 9 中作为实验性功能添加。AOT是提升Java程序性能的一种方法,特别是提供JVM的启动时间。在启动虚拟机之前,将Java类编译为本机代码。改进小型和大型Java应用程序的启动时间。

f5465245的博客 831

动力节点王鹤SpringBoot3笔记-了解AOT和GraalVM

Ahead-of-Time Compilation :预编译(提前编译)它在 JEP-295 中描述,并在 Java 9 中作为实验性功能添加。AOT是提升Java程序性能的一种方法,特别是提供JVM的启动时间。在启动虚拟机之前,将Java类编译为本机代码。改进小型和大型Java应用程序的启动时间。

DDDYSz的博客 707

王鹤SpringBoot3——超全超详细目录

王鹤SpringBoot3——超全超详细目录

f5465245的博客 571

Java学习路线第五篇:微服务框架(1)

本套视频基于SpringBoot2.4版本讲解。教程从细节入手,每个事例先讲解pom.xml中的重要依赖,其次application配置文件,最后是代码实现。让你知其所以,逐步让掌握SpringBoot框架的自动配置,starter起步依赖等特性。

m0_47946173的博客 1242

Java AOT初探:提升性能的编程技巧

通过将代码提前编译成本地机器码,AOT编译可以减少解释执行和动态优化的开销,从而提高程序的性能。然而,需要注意的是,并非所有的Java代码都适合进行AOT编译,而且AOT编译也可能导致一些特定场景下的性能下降。AOT编译可以将Java字节码转换为本地机器码,消除了解释执行和动态优化的开销,从而提高了程序的性能。本文将介绍如何使用AOT编译技术来改善Java程序的性能,并通过相应的源代码进行演示。参数,并指定AOT编译生成的机器码文件,我们可以让JVM加载并执行AOT编译后的代码。如有任何疑问,请随时提问。

BitSlinger的博客 550

动力节点-SpringBoot3.pdf

动力节点-SpringBoot3.pdf

Materials Studio与LAMMPS联合作战:如何用msi2lmp.exe完美转换聚合物模型(含PCFF力场配置)

本文详细解析了如何利用msi2lmp.exe工具将Materials Studio中的聚合物模型高效、准确地转换为LAMMPS可识别的data文件,并重点配置PCFF力场。文章提供了从MS模型构建、文件导出到命令行转换、参数调整及转换后验证的全流程实战指南与避坑技巧,旨在帮助研究者解决模型转换中的常见问题,实现跨平台分子动力学模拟的无缝衔接。

weixin_29228781的博客 527

统一大型语言模型和知识图谱:路线图

大型语言模型(LLM),如ChatGPT和GPT4,由于其涌现能力和泛化性,正在自然语言处理和人工智能领域掀起新的浪潮。然而,LLM是黑箱模型,通常无法捕捉和获取事实知识。相反,知识图谱(KGs),例如维基百科和华普,是显式存储丰富事实知识的结构化知识模型。KGs可以通过为推理和可解释性提供外部知识来增强LLM。同时,KGs很难从本质上构建和演化,这对KGs中现有的生成新事实和表示未知知识的方法提出了挑战。因此,将LLM和KGs统一在一起并同时利用它们的优势是相辅相成的。

qq_32907491的博客 2845

【移远EG800K-CN】从AT指令到MQTT实战:4G模块云端通信全解析

本文详细解析移远EG800K-CN 4G模块的AT指令应用与MQTT云端通信实战。从硬件连接到网络配置,再到MQTT协议的数据上报与命令接收,提供了完整的物联网通信解决方案,帮助开发者快速实现设备与云端的稳定数据交互。

o1p2q3r的博客 566

实现labelme批量json_to_dataset方法

labelme可以帮助我们快速的实现Mask-RCNN中数据集json文件的生成,然而还需要我们进一步的将json转成dataset,可以直接在cmd中执行labelme_json_to_dataset.exe C:\Users\Administrator\Desktop\total\1.json(路径),但是这个过程需要我们一个json文件的生成,过程很慢。 一、打开abelm...

简简单单 5万+

LT9611EX芯片实战:如何用双端口MIPI转HDMI1.4打造高清播放器(附配置代码)

本文详细介绍了如何使用龙迅半导体的LT9611EX芯片实现双端口MIPI转HDMI1.4的高清播放器开发。内容涵盖芯片特性、硬件设计要点、寄存器配置技巧及完整代码实现,特别适合嵌入式视频处理应用,如机顶盒和便携式媒体播放器。

weixin_29256771的博客 327

【OpenClaw从入门到精通】第63篇:A股智能分析实战——用OpenClaw搭建个人量化研究助手(2026实测版)

2026年,OpenClaw已成为量化投研圈的现象级工具,八家头部券商密集发布专题研报力证其价值。传统量化投研面临技术门槛高、重复劳动多、策略迭代慢、非结构化数据处理弱四大痛点,而OpenClaw通过“AI智能体+金融Skill+量化API”的融合,实现了从数据获取、策略生成、回测验证到持仓监控的全流程自动化。本文基于2026年最新实测经验,完整呈现个人量化研究助手搭建:从阿里云部署、阿里云百炼API配置(含解析失败解决方案)、Tushare数据源接入,到PB-ROE价值选股、研报复现、自动化回测、持仓监控

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1071

【K210+STM32项目】基于K210与STM32协同工作的智能垃圾分类系统设计与实现(更新3.0版本)(完整工程资料源码)

STM32F407STM32F407_2(含有app功能)

嵌入式技术开发 2500

华为OD机试真题2026双机位C卷 C语言 实现【明日之星选举】

给定一组选票votes。votes[i]代表第 i 张选票的内容,包含一个字符串"zhangsan,hanmei",表示推荐zhangsan为明日之星,反对 hanmei 称为明日之星。赞成或反对使用逗号(,)分割。 给定一个数组n,表示最后将筛选出赞成票最多的n个人,如果赞成票相同,则反对票越少,排序越靠前;如果赞成票和反对票都相同,则按照姓名字典序升序排序。

MISAYAONE的博客 189

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

上一篇: 动力节点王鹤SpringBoot3笔记——第八章 文章管理模块
下一篇: 动力节点Springsecurity笔记01-05认证入门
Java___interview
博客等级 码龄6年 154粉丝 109原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址