Java 诊断工具 Arthas 常见命令(超详细实战教程)

通过arthas vmtool 调用线上正在运行的service方法 通过arthas vmtool 调用线上正在运行的service方法。 阅读详情

点击上方“芋道源码”,选择“设为星标”

管她前浪,还是后浪?

能浪的浪,才是好浪!

每天 10:33 更新文章,每天掉亿点点头发...

源码精品专栏

 

来源:blog.youkuaiyun.com/qq_35427589/

article/details/125331696


基本概念

云杏这么多微服务,当然需要一个诊断利器来排查问题。

Arthas 是阿里开源的挚爱工具,关注开发者开发者。查问题,独立重启跟踪 Java 代码;实时 JVM 在线监控。Arthas 6+,Linux/Mac/Windows,支持 JDK 支持 Java 模式,同时提供丰富的 Tab 自动补全功能,进一步方便进行问题的定位和诊断。

c27372e5bd677987aca290423c4975a0.png

官方定义为应用诊断利器,从此Javagithub获得了29.4K个star。

可以用来查看线程值,内存,GC异常和运行时,查看入参返回/显示快速应用的提示,生成图等功能,帮助排查难问题。本文主要讲述常见的使用命令。

常见命令

启动arthas-demo(案例程序)

执行如下命令下载arthas-demo.jar,再用java -jar命令启动程序:

wget https://arthas.aliyun.com/arthas-demo.jar;
java -jar arthas-demo.jar

启动arthas-boot(诊断工具程序)

执行如下命令下载arthas-boot.jar,再用java -jar命令启动:

wget https://arthas.aliyun.com/arthas-boot.jar;
java -jar arthas-boot.jar

arthas是Arthas boot的程序,用户会启动-启动所有的Java进程后,可以选择诊断需要的进程。

a795d5540ece595653342b8a7b22bb5a.png

选择要诊断的Java程序,我这里输入1,再按回车键(回车)。

附上成功之后,会打印Arthas LOGO。

05dd47d4fbb5e7061061ae5ae1fd8bba.png

输入帮助可以获取到阿尔萨斯相关命令帮助信息。

[arthas@1266]$ help
 NAME         DESCRIPTION                                                                             
 help         Display Arthas Help                                                                     
 auth         Authenticates the current session                                                       
 keymap       Display all the available keymap for the specified connection.                          
 sc           Search all the classes loaded by JVM                                                    
 sm           Search the method of classes loaded by JVM                                              
 classloader  Show classloader info                                                                   
 jad          Decompile class                                                                         
 getstatic    Show the static field of a class                                                        
 monitor      Monitor method execution statistics, e.g. total/success/failure count, average rt, fail 
               rate, etc.                                                                             
 stack        Display the stack trace for the specified class and method                              
 thread       Display thread info, thread stack                                                       
 trace        Trace the execution time of specified method invocation.                                
 watch        Display the input/output parameter, return object, and thrown exception of specified me 
              thod invocation                                                                         
 tt           Time Tunnel                                                                             
 jvm          Display the target JVM information                                                      
 memory       Display jvm memory info.                                                                
 perfcounter  Display the perf counter information.                                                   
 ognl         Execute ognl expression.                                                                
 mc           Memory compiler, compiles java files into bytecode and class files in memory.           
 redefine     Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)              
 retransform  Retransform classes. @see Instrumentation#retransformClasses(Class...)                  
 dashboard    Overview of target jvm's thread, memory, gc, vm, tomcat info.                           
 dump         Dump class byte array from JVM                                                          
 heapdump     Heap dump                                                                               
 options      View and change various Arthas options                                                  
 cls          Clear the screen                                                                        
 reset        Reset all the enhanced classes                                                          
 version      Display Arthas version                                                                  
 session      Display current session information                                                     
 sysprop      Display, and change the system properties.                                              
 sysenv       Display the system env.                                                                 
 vmoption     Display, and update the vm diagnostic options.                                          
 logger       Print logger info, and update the logger level                                          
 history      Display command history                                                                 
 cat          Concatenate and print files                                                             
 base64       Encode and decode using Base64 representation                                           
 echo         write arguments to the standard output                                                  
 pwd          Return working directory name                                                           
 mbean        Display the mbean information                                                           
 grep         grep command for pipes.                                                                 
 tee          tee command for pipes.                                                                  
 profiler     Async Profiler. https://github.com/jvm-profiling-tools/async-profiler                   
 vmtool       jvm tool                                                                                
 stop         Stop/Shutdown Arthas server and exit the console.

与linux同样规则的命令此处不再赘述。如:history,cat,echo,pwd,grep。

系统的实时数据面板仪表板命令

112dee417270032312e61b3c5c37eb47.png仪表板可以命令查看当前系统的实时数据面板。可以查看到 CPU、内存、GC、运行环境等信息。

输入 q 或者 Ctrl+C 可以退出仪表板命令。

打印线程ID的栈线程

thread 1 命令会打印线程ID 1的栈。用thread 1 | grep 'main(' 查找到主类。

0260b1bef331e93984a838fbcc2e080f.png

查找JVM中已加载的类 sc/sm

可以通过sc命令来查找JVM里已经加载的打印类,通过-d参数,可以出类的具体信息,很方便查找类的加载问题。

[arthas@1266]$ sc -d *MathGame
 class-info        demo.MathGame                                                                                             
 code-source       /home/shell/arthas-demo.jar                                                                               
 name              demo.MathGame                                                                                             
 isInterface       false                                                                                                     
 isAnnotation      false                                                                                                     
 isEnum            false                                                                                                     
 isAnonymousClass  false                                                                                                     
 isArray           false                                                                                                     
 isLocalClass      false                                                                                                     
 isMemberClass     false                                                                                                     
 isPrimitive       false                                                                                                     
 isSynthetic       false                                                                                                     
 simple-name       MathGame                                                                                                  
 modifier          public                                                                                                    
 annotation                                                                                                                  
 interfaces                                                                                                                  
 super-class       +-java.lang.Object                                                                                        
 class-loader      +-sun.misc.Launcher$AppClassLoader@1b6d3586                                                               
                     +-sun.misc.Launcher$ExtClassLoader@107df6e5                                                             
 classLoaderHash   1b6d3586                                                                                                  

Affect(row-cnt:1) cost in 50 ms.

sc支持通配,比如搜索所有的StringUtils:

sc *StringUtils

查找UserController的ClassLoader

[arthas@1266]$ sc -d com.example.demo.arthas.user.UserController | grep classLoaderHash
 classLoaderHash   19469ea2

sm命令类似:查找类的具体函数。

sm java.math.RoundingMode

通过 -d 参数可以打印函数的具体属性:

sm -d java.math.RoundingMode

查找特定的函数,例如查找构造函数:

sm java.math.RoundingMode <init>

反编译代码 jad命令

jad demo.MathGame

71e1129974239010f43c794c1254005f.png

通过--source-only参数可以只打印出在反编译的源代码:

jad --source-only com.example.demo.arthas.user.UserController

动态执行代码 ognl 命令

在Arthas里,有一个ognl命令,可以动态执行代码。这个有点秀啊😯😯😯

调用静态函数
ognl '@java.lang.System@out.println("hello ognl")'
获取静态类的物理场

UserController类中的logger获取字段:

ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader @com.example.demo.arthas.user.UserController@logger

通过-x参数控制返回值的展开层数。

ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -x 2 @com.example.demo.arthas.user.UserController@logger
多行表达式,给与临时变量执行,返回一个列表
ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
  • OGNL 特殊用法请参考:https://github.com/alibaba/arthas/issues/71

  • OGNL 表达式官方指南:https://commons.apache.org/proper/commons-ognl/language-guide.html

查看函数的参数/异常信息 watch 命令/返回值

watch demo.MathGame primeFactors returnObj
e14ff6b116e0a26aa29b54e56452ae5c.png

查看JVM信息 sysprop sysenv jvm仪表板

系统道具
  • sysprop :打印所有的System Properties信息。

  • 指定密钥:sysprop user.dir。

  • 通过grep过滤:sysprop | grep user。

  • 设置新的价值:sysprop testKey testValue。

系统环境

sysenv 命令可以类似地获取到环境变量。和 sysprop 命令。

虚拟机

jvm 命令会打印出 JVM 的各种详细信息。

仪表板

仪表板可以命令查看当前系统的实时数据面板。

重置类重置命令

通过reset命令可以还原类,将Arthas过码的类全部关闭,Arthas增强服务端时会重置所有过的类。Arthas在等命令的时候watch/trace,其实是应用的字节修改,插入的增强代码。显式执行重置命令,可以清除掉这些增强代码。

reset 指定类:

reset demo.MathGame

所有还原类:

reset

查看当前会话信息会话

13d31a0222721e9ec7e34ba447a09c01.png
tee 命令

传统的 tee 命令类似用于读取标准输入的数据,并将其内容输出成文件。

tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。

查看当前Arthas版本

[arthas@1710]$ version
3.6.2

退出阿尔萨斯

输入退出或退出命令可以退出阿尔萨斯当前会话。执行命令停止彻底退出阿尔萨斯。

📌PS:所有命令都可以通过 -h 参数查看帮助信息。

基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 用户小程序,支持 RBAC 动态权限、多租户、数据权限、工作流、三方登录、支付、短信、商城等功能

  • 项目地址:https://gitee.com/zhijiantianya/ruoyi-vue-pro

  • 视频教程:https://doc.iocoder.cn/video/

实操案例

排查函数调用异常

通过curl可以看到异常,但是可以看到具体的请求参数和信息。

shell@Alicloud:~$ curl http://localhost:61000/user/0
{"timestamp":1655435063042,"status":500,"error":"Internal Server Error","exception":"java.lang.IllegalArgumentException","message":"id < 1","path":"/user/0"}

查看UserController的参数/异常

在Arthas里执行:

watch com.example.demo.arthas.user.UserController * '{params, throwExp}'
  • 第一个参数是类名,支持通配

  • 第二个参数是函数名,支持通配访问curl http://localhost:61000/user/0,watch命令会打印调用的参数和异常

再次通过curl调用可以在arthas里面查看到具体的异常信息。

f2a8b9f2f232f7384eae8b5157c8392e.png

获取到的结果展开,可以用-x参数:

watch com.example.demo.arthas.user.UserController * '{params, throwExp}' -x 2

返回值表达式

在上面的例子里,第三个参数是返回值表达式,它实际上是一个表达式,它支持一些组合对象:

  • 装载机

  • 克拉兹

  • 方法

  • 目标

  • 参数

  • 返回对象

  • throwExp

  • 之前

  • 是抛出

  • 是返回

返回目录:

watch com.example.demo.arthas.user.UserController * '{params[0], target, returnObj}'

表达式条件

看命令支持在第4个参数里写条件表达式,比如:

  • 当访问user/1时,观察命令没有输出

  • 当访问user/101时,手表会打印出结果。

f732a456e157ca2995e5f620c4605ee5.png

当异常时姓名

观看命令支持-e选项,表示只发射异常时的请求:

watch com.example.demo.arthas.user.UserController * "{params[0],throwExp}" -e

自动进行过滤

观看命令支持按请求进行过滤,例如:

watch com.example.demo.arthas.user.UserController * '{params, returnObj}' '#cost>200'

热更新代码

这个人也是真的秀。

访问http://localhost:61000/user/0,会返回500个异常:

shell@Alicloud:~$ curl http://localhost:61000/user/0
{"timestamp":1655436218020,"status":500,"error":"Internal Server Error","exception":"java.lang.IllegalArgumentException","message":"id < 1","path":"/user/0"}

通过热更新代码,修改这个逻辑。

jad反编译UserController

jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java

jad反编译的结果保存在/tmp/UserController.java文件里了。

再打开一个终端窗口,然后用vim来编辑/tmp/UserController.java:

vim /tmp/UserController.java

比如说当user id小于1时,也正常返回,不抛出异常:

@GetMapping(value={"/user/{id}"})
public User findUserById(@PathVariable Integer id) {
    logger.info("id: {}", (Object)id);
    if (id != null && id < 1) {
        return new User(id, "name" + id);
        // throw new IllegalArgumentException("id < 1");
    }
    return new User(id.intValue(), "name" + id);
    }

sc查找加载UserController的ClassLoader

[arthas@1266]$ sc -d *UserController | grep classLoaderHash
 classLoaderHash   19469ea2

classLoaderHash 是 19469ea2,后面需要使用它。

麦克

保存好/tmp/UserController.java之后,使用mc(Memory Compiler)命令来编译,并通过-c或–classLoaderClass参数指定ClassLoader:

mc --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader /tmp/UserController.java -d /tmp
[arthas@1266]$ mc --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader /tmp/UserController.java -d /tmp
Memory compiler output:
/tmp/com/example/demo/arthas/user/UserController.class
Affect(row-cnt:1) cost in 2879 ms.

也可以通过mc -c /tmp/UserController.java -d /tmp,使用 -c 参数指定ClassLoaderHash:

mc -c 19469ea2 /tmp/UserController.java -d /tmp

重新定义

再使用redefine命令重新加载新编译好的UserController.class:

[arthas@1266]$ redefine /tmp/com/example/demo/arthas/user/UserController.class
redefine success, size: 1, classes:
com.example.demo.arthas.user.UserController

热修改代码结果

重新定义成功之后,再次访问user/0,结果正常

shell@Alicloud:~$ curl http://localhost:61000/user/0
{"id":0,"name":"name0"}

动态更新应用Logger Level

查找UserController的ClassLoader
[arthas@1266]$ sc -d *UserController | grep classLoaderHash
 classLoaderHash   19469ea2

用ognl获取logger

ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader ‘@com.example.demo.arthas.user.UserController@logger’
[arthas@1266]$ ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader '@com.example.demo.arthas.user.UserController@logger'
@Logger[
    serialVersionUID=@Long[5454405123156820674],
    FQCN=@String[ch.qos.logback.classic.Logger],
    name=@String[com.example.demo.arthas.user.UserController],
    level=null,
    effectiveLevelInt=@Integer[20000],
    parent=@Logger[Logger[com.example.demo.arthas.user]],
    childrenList=null,
    aai=null,
    additive=@Boolean[true],
    loggerContext=@LoggerContext[ch.qos.logback.classic.LoggerContext[default]],
]

可以知道UserController@logger实际使用的是logback。可以看到level=null,则说明实际最终的level是从root logger里来的。

单独设置UserController的logger级别

ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader '@com.example.demo.arthas.user.UserController@logger.setLevel(@ch.qos.logback.classic.Level@DEBUG)'

再次获取UserController@logger,可以发现已经是DEBUG了。

修改logback的记录器级别

通过获取root logger,可以修改的logger level:

ognl --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader '@org.slf4j.LoggerFactory@getLogger("root").setLevel(@ch.qos.logback.classic.Level@DEBUG)'

获取Spring Context,在获取bean,再调用函数

使用tt命令获取到spring上下文

tt即TimeTunnel它可以记录下指定的方法,每次调用的入能和返回信息,并在下调用的时间对不同的进行调用。

官方tt说明:https://arthas.aliyun.com/doc/tt.html

tt -t org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter invokeHandlerMethod

访问用户/1:

curl http://localhost:61000/user/1

可以看到父母到了一个请求:

10bf1c27216cbce50cf56e2817fa8664.png输入 q 或者 Ctrl + C 退出的 tt -t 命令。

使用tt命令从调用记录里获取到spring上下文

tt -i 1000 -w 'target.getApplicationContext()'

获取spring bean,并调用函数

tt -i 1000 -w ‘target.getApplicationContext().getBean(“helloWorldService”).getHelloMessage()’

结果如下:

[arthas@1266]$ tt -i 1000 -w 'target.getApplicationContext().getBean("helloWorldService").getHelloMessage()'
@String[Hello World]
Affect(row-cnt:1) cost in 1 ms.

排查HTTP请求返回401

请求接口没有权限的时候一般就返回401 Unauthorized。

401是被权限管理的过滤器拦截了,到底是哪个过滤器处理了这个请求,返回401?

监视所有的过滤功能

开始追踪:

trace javax.servlet.Filter *

可以在调用树的最全集,找到AdminFilterConfig$AdminFilter返回的401

+---[3.806273ms] javax.servlet.FilterChain:doFilter()
|   `---[3.447472ms] com.example.demo.arthas.AdminFilterConfig$AdminFilter:doFilter()
|       `---[0.17259ms] javax.servlet.http.HttpServletResponse:sendError()

通过栈调用栈

上面是通过trace命令来获取信息,从里,我们可以知道通过stack跟踪HttpServletResponse:sendError()结果,同样可以知道返回的是哪个Filter了401

执行:

stack javax.servlet.http.HttpServletResponse sendError 'params[0]==401'

可以查看以下信息:

2a3b9a59952e243bd6229e2d7c5ceb4a.png

寻找顶部 N 线程

查看所有地址
thread
查看具体的线程栈

查看线程ID 2的栈:

thread 2

查看CPU使用率最高的线程的栈

thread -n 3

查看5秒内的CPU使用率顶部线程栈

thread -n 3 -i 5000

寻找是否有拒绝

thread -b

更多使用查看:

  • Github地址:https://github.com/alibaba/arthas

  • 文档地址:https://arthas.aliyun.com/doc/



欢迎加入我的知识星球,一起探讨架构,交流源码。加入方式,长按下方二维码噢:

5c664b9b3072f4f3771b3a4f90dfb19d.png

已在知识星球更新源码解析如下:

5d8970e3c3de34229085444be42b80bd.jpeg

bbd816ca0453f025c9a3f4f175e61cca.jpeg

7cb0562916e8ebd06267c27332ccd3e0.jpeg

28c480d421ba66b2708012ada0a99884.jpeg

最近更新《芋道 SpringBoot 2.X 入门》系列,已经 101 余篇,覆盖了 MyBatis、Redis、MongoDB、ES、分库分表、读写分离、SpringMVC、Webflux、权限、WebSocket、Dubbo、RabbitMQ、RocketMQ、Kafka、性能测试等等内容。

提供近 3W 行代码的 SpringBoot 示例,以及超 4W 行代码的电商微服务项目。

获取方式:点“在看”,关注公众号并回复 666 领取,更多内容陆续奉上。

文章有帮助的话,在看,转发吧。
谢谢支持哟 (*^__^*)
详解Alibaba开源的Java诊断工具Arthas的常用命令 Arthas 是Alibaba开源的Java诊断工具,动态跟踪Java代码;实时监控JVM状态,可以在不中断程序执行的情况下轻松完成JVM相关问题排查工作。支持JDK 6+,支持Linux/Mac/Windows。这个工具真的很好用,而且入门超简单,十分推荐。 阅读详情

相关推荐

非常好用的Java诊断工具Arthas(阿尔萨斯)

Java项目诊断工具

qq_43108153的博客 2387

Arthas 入门到实战(一)快速入门,常用命令

Arthas 入门到实战(一)快速入门

m0_47743175的博客 2821

Arthas 工具介绍与实战

Arthas 是一款开源的 Java 诊断工具,由阿里巴巴开源,用于帮助开发者排查 Java 应用程序的性能问题和故障。它可以无需修改应用程序代码,实时监控和分析 Java 应用程序,并提供丰富的命令和功能,如查看方法执行耗时、查看类加载情况、动态修改方法内容等arthasArthas 是一个功能强大的 Java 诊断工具,它能够帮助开发者在生产环境中实时诊断和定位 Java 应用程序的问题。通过本文介绍的安装和应用场景,希望能够帮助读者更好地了解和使用 Arthas 工具。快速入门 | arthas。

EverythingAtOnce的博客 1738

Arthas(阿尔萨斯)--(一)

Arthas是Alibaba开源的Java诊断工具,深受开发者喜爱。当你遇到以下类似问题而束手无策时,Arthas可以帮助你解决:1.这个类从哪个jar包加载的?为什么会报各种类相关的Exception?2.我改的代码为什么没有执行到?3.遇到问题无法在线上Debug,难道只能通过日志再重新发布吗?4.线上遇到某个用户的数据处理有问题,但线上同样无法Debug,线下无法重现!5.是否有一个全局视角来查看系统的运行状况?6.有什么办法可以监控到JVM的实时运行状态?7.怎么快速定位应用的热点,生成火焰图?Ar

杀神lwz的博客 3725

Arthas Java诊断工具实战教程

Arthas是一个动态追踪Java应用程序的诊断工具,它由阿里巴巴开源,旨在帮助开发者快速定位和解决问题。通过提供丰富的诊断命令,Arthas能让开发者无需修改代码、无需重启服务、无需加载新的class文件即可对线上生产环境中的Java应用程序进行诊断分析,解决生产环境中的棘手问题。Arthas的设计初衷是提供一种简便、高效的方式来对Java程序进行问题诊断,尤其是对于那些无法通过传统日志和监控手段来定位的问题。

weixin_35671843的博客 980

Solidworks转URDF避坑实录:从履带机器人到ROS仿真的完整配置流程

本文详细介绍了将Solidworks履带机器人模型转换为URDF格式并配置ROS仿真的完整流程,重点解析了坐标系设置、复杂关节定义、插件配置等关键步骤中的常见问题与解决方案,帮助开发者高效实现履带机器人在RVIZ和Gazebo中的精确仿真。

weixin_30693683的博客 458

Arthas(阿尔萨斯)使用

Arthas 是Alibaba开源的Java诊断工具。安装在系统所在服务器。可以帮助开发人员或者运维人员查找问题,分析性能,bug追踪。开源地址:https://github.com/alibaba/arthas官方文档:https://alibaba.github.io/arthas。

皮球 4011

Win11系统下Notepad++右键菜单失效?3种修复方法实测有效(附注册表备份指南)

本文针对Windows 11系统中Notepad++右键菜单失效的常见问题,提供了三种经过实测有效的修复方法。核心解决方案包括使用官方NppShell.dll重新注册、手动修复注册表项以及系统级问题排查,并详细说明了操作前的注册表备份指南,确保修复过程安全可靠。

m2n3b4v5c6的博客 328

arthas的vmtool

arthas工具vmtool命令使用

qq_40911404的博客 5057

保姆级教程:在华为MateBook E Go上安装安卓子系统(含Hyper-V配置和地区切换避坑指南)

本文提供在华为MateBook E Go(ARM架构)上安装Windows 11安卓子系统(WSA)的详细指南。重点阐述了ARM平台无需指令转译的流畅原生体验优势,并逐步讲解启用Hyper-V虚拟化、切换系统区域以安装Amazon Appstore、配置开发人员模式及使用ADB安装第三方应用(如华为应用市场)的全过程,助您解锁高效的原生安卓应用生态。

kafka6courier的博客 550

Airsim动态 | 安装ROS包装器(AirSim ROS Wrapper)

本期内容我们将带来在Airsim环境下使用ROS Wrapper的相关教程,以下是AirSim客户端库上的一些ROS Wrapper相关配置。 一、启动 以下步骤适用于 Linux 系统。如果是在 Windows 上运行 AirSim,可以使用 Windows Subsystem for Linux (WSL) 来运行 ROS 包装器,如果不想在主机上安装ROS相关工具,也可以使用Docker容器进行安装。请检查下方内容并按照需求安装,具体内容可以参照最后网址。 如果您的默认 GCC 版本不是8或更高版.

AMOVLAB(阿木实验室) 1776

Arthas使用教程 阿里巴巴开源项目、史上最强java线上诊断工具

什么是 Arthas 摘录一段官方 Github 上的简介 Arthas 是Alibaba开源的Java诊断工具,深受开发者喜爱。 当你遇到以下类似问题而束手无策时,Arthas 可以帮助你解决: 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception? 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了? 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现! 是否有一个全局视角来.

叶新东老师的博客 1万+

【机器人学习】abb工业机器人运动学分析与圆弧轨迹规划(三维模型+matlab代码)

下载链接 solidworks模型 D-H建模 圆仿真过程 视频过程:

yjw0911的博客 2533

Java诊断工具-Arthas保姆级教程

Java诊断工具-Arthas保姆级教程

qq_45443475的博客 1万+

从ISCXTor2016到CICIDS2017:手把手教你下载和使用UNB的网络安全数据集

本文详细介绍了UNB大学发布的ISCXTor2016和CICIDS2017等网络安全数据集的下载与使用方法,特别适合加密流量识别和网络行为分析研究。文章提供了多种高效获取路径、文件结构解析及实战分析示例,帮助研究者快速上手这些真实场景捕获的精细标注数据集。

weixin_42524945的博客 641

IC设计新手必看:如何正确使用去耦电容(decap)避免电源噪声?

本文深入探讨了IC设计中去耦电容(decap)的应用技巧,从核心原理到布局实现,帮助新手工程师有效抑制电源噪声。文章详细解析了MIM、MOM等电容类型的特性与选择策略,并提供了先进的布局技巧和验证方法,特别适用于28nm以下先进工艺的电路设计挑战。

weixin_30555125的博客 119

Java诊断工具Arthas入门教程

下载与安装 Linux安装 下载arthas-boot(推荐) 下载arthas-boot.jar,然后用java -jar的方式启动: wget https://alibaba.github.io/arthas/arthas-boot.jar java -jar arthas-boot.jar 打印帮助信息: java -jar arthas-boot.jar -h ...

淡淡的说非 2万+

一文速览:大模型语料构建与基础训练全流程实战指南

因为模型只有看到足够丰富、高质量的数据,才能真正学到“真本事”,展现出更强大的泛化能力,也就是能够在全新的场景和任务下,做出准确的推理和判断。我们日常做饭的时候,通常会先把买回来的菜仔细清洗干净,把坏掉的叶子、泥土、杂质等去除掉。同理,训练大模型的数据就像我们的食材,如果不干净,就会影响模型的学习效果,甚至训练出逻辑紊乱的模型。在大模型的世界里,有一句名言:“Garbage in, Garbage out”,翻译过来就是“垃圾输入,垃圾输出”,说白了,就是给模型喂的是什么数据,它学到的就是什么知识。

master_hunter的博客 1673

Java诊断工具Arthas

简介 Arthas 是Alibaba开源的Java诊断工具,动态跟踪Java代码;实时监控JVM状态,可以在不中断程序执行的情况下轻松完成JVM相关问题排查工作 。支持JDK 6+,支持Linux/Mac/Windows。 使用场景 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception? 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了? 遇到问题无法在线上...

dan_seek的博客 1356

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Java 诊断工具 Arthas 常见命令使用和实战(排查函数调用异常、热更新、调用方法函数、查看堆栈调用等)

Java 诊断工具 Arthas 常见命令使用和实战(排查函数调用异常、热更新、调用方法函数、查看堆栈调用等)

write less , do more 2万+

深度学习工具包 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'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('DeepLearnToolbox'));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('state',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'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',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 = 'sigm';%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, 'Too big error');```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('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';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)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';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, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% 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'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 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, 'Too big error');```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('state',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, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',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, 'Too big error');%% ex3 neural net with dropoutrand('state',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, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % 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, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % 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, 'Too big error');%% 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('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % 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, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Arthas在线诊断工具,Arthas使用教程,Arthas常用命令

Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息,并能在不修改应用代码的情况下,对业务问题进行诊断,包括查看方法调用的出入参、异常,监测方法执行耗时,类加载信息等,大大提升线上问题排查效率。

Java码农杂谈 1344

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

阿里Java诊断工具 arthas - 介绍及指令大全

一、arthas Arthas` 是Alibaba开源的Java诊断工具,深受开发者喜爱。 当你遇到以下类似问题而束手无策时,Arthas可以帮助你解决: 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception? 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了? 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现! 是否有一个全局视角来查看系统的运行状况? 有什么办法可以监控到

小毕超博客 1万+

Arthas - Java 诊断工具

一、关于 Arthas 背景 相关链接资源 关键功能特性 二、安装与快速开始 1、使用 arthas-boot(推荐方式) 2、使用 as.sh 三、功能展示 1、Dashboard 2、线程分析 3、反编译(jad) 4、内存编译(mc) 5、类重定义(retransform) 6、类搜索(sc) 7、堆对象查询(vmtool) 8、调用栈追踪(stack) 9、方法调用追踪(trace) 10、方法观测(watch) 11、方法监控(monitor) 12、时间隧道(tt) 13、类加载器分析(clas

AI工程化、开源分享、文档翻译、代码笔记 2054
上一篇: 零侵入性:一个注解,优雅的实现循环重试功能
下一篇: RedisJson 横空出世,比 ES 快7 倍,惊爆了!
公众号-芋道源码
博客等级 码龄10年 1639粉丝 377原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值