jvm調優工具arthas(阿爾薩斯)安裝與使用---實踐

jvm調優工具arthas(阿爾薩斯)安裝與使用—實踐

Arthas 是Alibaba開源的Java診斷工具,深受開發者喜愛。

當你遇到以下類似問題而束手無策時,Arthas可以幫助你解決:

  1. 這個類從哪個 jar 包加載的?為什么會報各種類相關的 Exception?
  2. 我改的代碼為什么沒有執行到?難道是我沒 commit?分支搞錯了?
  3. 遇到問題無法在線上 debug,難道只能通過加日志再重新發布嗎?
  4. 線上遇到某個用戶的數據處理有問題,但線上同樣無法 debug,線下無法重現!
  5. 是否有一個全局視角來查看系統的運行狀況?
  6. 有什么辦法可以監控到JVM的實時運行狀態?
  7. 怎么快速定位應用的熱點,生成火焰圖?
  8. 怎樣直接從JVM內查找某個類的實例?

Arthas支持JDK 6+(4.x 版本不再支持 JDK 6 和 JDK 7),支持Linux/Mac/Windows,采用命令行交互模式,同時提供豐富的 Tab 自動補全功能,進一步方便進行問題的定位和診斷。

官方文檔

1. 啟動 math-game

curl -O https://arthas.aliyun.com/math-game.jar
java -jar math-game.jar

math-game是一個簡單的程序,每隔一秒生成一個隨機數,再執行質因數分解,并打印出分解結果。

2. 啟動 arthas

在命令行下面執行(使用和目標進程一致的用戶啟動,否則可能 attach 失敗):

curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar
  • 執行該程序的用戶需要和目標進程具有相同的權限。比如以admin用戶來執行:sudo su admin && java -jar arthas-boot.jarsudo -u admin -EH java -jar arthas-boot.jar
  • 如果 attach 不上目標進程,可以查看~/logs/arthas/ 目錄下的日志。
  • 如果下載速度比較慢,可以使用 aliyun 的鏡像:java -jar arthas-boot.jar --repo-mirror aliyun --use-http
  • java -jar arthas-boot.jar -h 打印更多參數信息。

選擇應用 java 進程:

$ $ java -jar arthas-boot.jar
* [1]: 35542[2]: 71560 math-game.jar

math-game進程是第 2 個,則輸入 2,再輸入回車/enter。Arthas 會 attach 到目標進程上,并輸出日志:

[INFO] Try to attach process 71560
[INFO] Attach process 71560 success.
[INFO] arthas-client connect 127.0.0.1 3658,---.  ,------. ,--------.,--.  ,--.  ,---.   ,---./  O  \ |  .--. ''--.  .--'|  '--'  | /  O  \ '   .-'
|  .-.  ||  '--'.'   |  |   |  .--.  ||  .-.  |`.  `-.
|  | |  ||  |\  \    |  |   |  |  |  ||  | |  |.-'    |
`--' `--'`--' '--'   `--'   `--'  `--'`--' `--'`-----'wiki: https://arthas.aliyun.com/doc
version: 3.0.5.20181127201536
pid: 71560
time: 2018-11-28 19:16:24$

3. 查看 dashboard

輸入dashboard,按回車/enter,會展示當前進程的信息,按ctrl+c可以中斷執行。

$ dashboard
ID     NAME                   GROUP          PRIORI STATE  %CPU    TIME   INTERRU DAEMON
17     pool-2-thread-1        system         5      WAITIN 67      0:0    false   false
27     Timer-for-arthas-dashb system         10     RUNNAB 32      0:0    false   true
11     AsyncAppender-Worker-a system         9      WAITIN 0       0:0    false   true
9      Attach Listener        system         9      RUNNAB 0       0:0    false   true
3      Finalizer              system         8      WAITIN 0       0:0    false   true
2      Reference Handler      system         10     WAITIN 0       0:0    false   true
4      Signal Dispatcher      system         9      RUNNAB 0       0:0    false   true
26     as-command-execute-dae system         10     TIMED_ 0       0:0    false   true
13     job-timeout            system         9      TIMED_ 0       0:0    false   true
1      main                   main           5      TIMED_ 0       0:0    false   false
14     nioEventLoopGroup-2-1  system         10     RUNNAB 0       0:0    false   false
18     nioEventLoopGroup-2-2  system         10     RUNNAB 0       0:0    false   false
23     nioEventLoopGroup-2-3  system         10     RUNNAB 0       0:0    false   false
15     nioEventLoopGroup-3-1  system         10     RUNNAB 0       0:0    false   false
Memory             used   total max    usage GC
heap               32M    155M  1820M  1.77% gc.ps_scavenge.count  4
ps_eden_space      14M    65M   672M   2.21% gc.ps_scavenge.time(m 166
ps_survivor_space  4M     5M    5M           s)
ps_old_gen         12M    85M   1365M  0.91% gc.ps_marksweep.count 0
nonheap            20M    23M   -1           gc.ps_marksweep.time( 0
code_cache         3M     5M    240M   1.32% ms)
Runtime
os.name                Mac OS X
os.version             10.13.4
java.version           1.8.0_162
java.home              /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre

4. 通過 thread 命令來獲取到math-game進程的 Main Class

thread 1會打印線程 ID 1 的棧,通常是 main 函數的線程。

$ thread 1 | grep 'main('at demo.MathGame.main(MathGame.java:17)

5. 通過 jad 來反編譯 Main Class

$ jad demo.MathGameClassLoader:
+-sun.misc.Launcher$AppClassLoader@3d4eac69+-sun.misc.Launcher$ExtClassLoader@66350f69Location:
/tmp/math-game.jar/** Decompiled with CFR 0_132.*/
package demo;import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;public class MathGame {private static Random random = new Random();private int illegalArgumentCount = 0;public static void main(String[] args) throws InterruptedException {MathGame game = new MathGame();do {game.run();TimeUnit.SECONDS.sleep(1L);} while (true);}public void run() throws InterruptedException {try {int number = random.nextInt();List<Integer> primeFactors = this.primeFactors(number);MathGame.print(number, primeFactors);}catch (Exception e) {System.out.println(String.format("illegalArgumentCount:%3d, ", this.illegalArgumentCount) + e.getMessage());}}public static void print(int number, List<Integer> primeFactors) {StringBuffer sb = new StringBuffer("" + number + "=");Iterator<Integer> iterator = primeFactors.iterator();while (iterator.hasNext()) {int factor = iterator.next();sb.append(factor).append('*');}if (sb.charAt(sb.length() - 1) == '*') {sb.deleteCharAt(sb.length() - 1);}System.out.println(sb);}public List<Integer> primeFactors(int number) {if (number < 2) {++this.illegalArgumentCount;throw new IllegalArgumentException("number is: " + number + ", need >= 2");}ArrayList<Integer> result = new ArrayList<Integer>();int i = 2;while (i <= number) {if (number % i == 0) {result.add(i);number /= i;i = 2;continue;}++i;}return result;}
}Affect(row-cnt:1) cost in 970 ms.

6. watch

通過watch命令來查看demo.MathGame#primeFactors函數的返回值:

$ watch demo.MathGame primeFactors returnObj
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 107 ms.
ts=2018-11-28 19:22:30; [cost=1.715367ms] result=null
ts=2018-11-28 19:22:31; [cost=0.185203ms] result=null
ts=2018-11-28 19:22:32; [cost=19.012416ms] result=@ArrayList[@Integer[5],@Integer[47],@Integer[2675531],
]
ts=2018-11-28 19:22:33; [cost=0.311395ms] result=@ArrayList[@Integer[2],@Integer[5],@Integer[317],@Integer[503],@Integer[887],
]
ts=2018-11-28 19:22:34; [cost=10.136007ms] result=@ArrayList[@Integer[2],@Integer[2],@Integer[3],@Integer[3],@Integer[31],@Integer[717593],
]
ts=2018-11-28 19:22:35; [cost=29.969732ms] result=@ArrayList[@Integer[5],@Integer[29],@Integer[7651739],
]

7. 退出 arthas

如果只是退出當前的連接,可以用quit或者exit命令。Attach 到目標進程上的 arthas 還會繼續運行,端口會保持開放,下次連接時可以直接連接上。

如果想完全退出 arthas,可以執行stop命令。

參考文檔

  • 在線教程(推薦)

  • 用戶文檔

  • 安裝

  • 下載

  • 快速入門

  • 進階使用

  • 命令列表

  • WebConsole

  • Docker

  • Arthas Spring Boot Starter

  • 用戶案例

  • FAQ/常見問題

  • 編譯調試/參與貢獻

  • Release Notes

案例展示

Dashboard
  • https://arthas.aliyun.com/doc/dashboard
Thread
  • https://arthas.aliyun.com/doc/thread

一目了然的了解系統的狀態,哪些線程比較占cpu?他們到底在做什么?

$ thread -n 3
"as-command-execute-daemon" Id=29 cpuUsage=75% RUNNABLEat sun.management.ThreadImpl.dumpThreads0(Native Method)at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:440)at com.taobao.arthas.core.command.monitor200.ThreadCommand$1.action(ThreadCommand.java:58)at com.taobao.arthas.core.command.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:238)at com.taobao.arthas.core.command.handler.DefaultCommandHandler.handleCommand(DefaultCommandHandler.java:67)at com.taobao.arthas.core.server.ArthasServer$4.run(ArthasServer.java:276)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run(Thread.java:745)Number of locked synchronizers = 1- java.util.concurrent.ThreadPoolExecutor$Worker@6cd0b6f8"as-session-expire-daemon" Id=25 cpuUsage=24% TIMED_WAITINGat java.lang.Thread.sleep(Native Method)at com.taobao.arthas.core.server.DefaultSessionManager$2.run(DefaultSessionManager.java:85)"Reference Handler" Id=2 cpuUsage=0% WAITING on java.lang.ref.Reference$Lock@69ba0f27at java.lang.Object.wait(Native Method)-  waiting on java.lang.ref.Reference$Lock@69ba0f27at java.lang.Object.wait(Object.java:503)at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
jad
  • https://arthas.aliyun.com/doc/jad

對類進行反編譯:

$ jad javax.servlet.ServletClassLoader:
+-java.net.URLClassLoader@6108b2d7+-sun.misc.Launcher$AppClassLoader@18b4aac2+-sun.misc.Launcher$ExtClassLoader@1ddf84b8Location:
/Users/xxx/work/test/lib/servlet-api.jar/** Decompiled with CFR 0_122.*/
package javax.servlet;import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;public interface Servlet {public void init(ServletConfig var1) throws ServletException;public ServletConfig getServletConfig();public void service(ServletRequest var1, ServletResponse var2) throws ServletException, IOException;public String getServletInfo();public void destroy();
}
mc
  • https://arthas.aliyun.com/doc/mc

Memory Compiler/內存編譯器,編譯.java文件生成.class

mc /tmp/Test.java
retransform
  • https://arthas.aliyun.com/doc/retransform

加載外部的.class文件,retransform 熱更新jvm已加載的類。

retransform /tmp/Test.class
retransform -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class
sc
  • https://arthas.aliyun.com/doc/sc

查找JVM中已經加載的類

$ sc -d org.springframework.web.context.support.XmlWebApplicationContextclass-info        org.springframework.web.context.support.XmlWebApplicationContextcode-source       /Users/xxx/work/test/WEB-INF/lib/spring-web-3.2.11.RELEASE.jarname              org.springframework.web.context.support.XmlWebApplicationContextisInterface       falseisAnnotation      falseisEnum            falseisAnonymousClass  falseisArray           falseisLocalClass      falseisMemberClass     falseisPrimitive       falseisSynthetic       falsesimple-name       XmlWebApplicationContextmodifier          publicannotationinterfacessuper-class       +-org.springframework.web.context.support.AbstractRefreshableWebApplicationContext+-org.springframework.context.support.AbstractRefreshableConfigApplicationContext+-org.springframework.context.support.AbstractRefreshableApplicationContext+-org.springframework.context.support.AbstractApplicationContext+-org.springframework.core.io.DefaultResourceLoader+-java.lang.Objectclass-loader      +-org.apache.catalina.loader.ParallelWebappClassLoader+-java.net.URLClassLoader@6108b2d7+-sun.misc.Launcher$AppClassLoader@18b4aac2+-sun.misc.Launcher$ExtClassLoader@1ddf84b8classLoaderHash   25131501
vmtool
  • https://arthas.aliyun.com/doc/vmtool

從JVM heap中獲取指定類的實例。

$ vmtool --action getInstances --className java.lang.String --limit 10
@String[][@String[com/taobao/arthas/core/shell/session/Session],@String[com.taobao.arthas.core.shell.session.Session],@String[com/taobao/arthas/core/shell/session/Session],@String[com/taobao/arthas/core/shell/session/Session],@String[com/taobao/arthas/core/shell/session/Session.class],@String[com/taobao/arthas/core/shell/session/Session.class],@String[com/taobao/arthas/core/shell/session/Session.class],@String[com/],@String[java/util/concurrent/ConcurrentHashMap$ValueIterator],@String[java/util/concurrent/locks/LockSupport],
]
stack
  • https://arthas.aliyun.com/doc/stack

查看方法 test.arthas.TestStack#doGet 的調用堆棧:

$ stack test.arthas.TestStack doGet
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 286 ms.
ts=2018-09-18 10:11:45;thread_name=http-bio-8080-exec-10;id=d9;is_daemon=true;priority=5;TCCL=org.apache.catalina.loader.ParallelWebappClassLoader@25131501@test.arthas.TestStack.doGet()at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:451)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1121)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:745)
Trace
  • https://arthas.aliyun.com/doc/trace

觀察方法執行的時候哪個子調用比較慢:

Watch
  • https://arthas.aliyun.com/doc/watch

觀察方法 test.arthas.TestWatch#doGet 執行的入參,僅當方法拋出異常時才輸出。

$ watch test.arthas.TestWatch doGet {params[0], throwExp} -e
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 65 ms.
ts=2018-09-18 10:26:28;result=@ArrayList[@RequestFacade[org.apache.catalina.connector.RequestFacade@79f922b2],@NullPointerException[java.lang.NullPointerException],
]
Monitor
  • https://arthas.aliyun.com/doc/monitor

監控某個特殊方法的調用統計數據,包括總調用次數,平均rt,成功率等信息,每隔5秒輸出一次。

$ monitor -c 5 org.apache.dubbo.demo.provider.DemoServiceImpl sayHello
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 109 ms.timestamp            class                                           method    total  success  fail  avg-rt(ms)  fail-rate
----------------------------------------------------------------------------------------------------------------------------2018-09-20 09:45:32  org.apache.dubbo.demo.provider.DemoServiceImpl  sayHello  5      5        0     0.67        0.00%timestamp            class                                           method    total  success  fail  avg-rt(ms)  fail-rate
----------------------------------------------------------------------------------------------------------------------------2018-09-20 09:45:37  org.apache.dubbo.demo.provider.DemoServiceImpl  sayHello  5      5        0     1.00        0.00%timestamp            class                                           method    total  success  fail  avg-rt(ms)  fail-rate
----------------------------------------------------------------------------------------------------------------------------2018-09-20 09:45:42  org.apache.dubbo.demo.provider.DemoServiceImpl  sayHello  5      5        0     0.43        0.00%
Time Tunnel(tt)
  • https://arthas.aliyun.com/doc/tt

記錄方法調用信息,支持事后查看方法調用的參數,返回值,拋出的異常等信息,仿佛穿越時空隧道回到調用現場一般。

$ tt -t org.apache.dubbo.demo.provider.DemoServiceImpl sayHello
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 75 ms.INDEX   TIMESTAMP            COST(ms)  IS-RET  IS-EXP   OBJECT         CLASS                          METHOD
-------------------------------------------------------------------------------------------------------------------------------------1000    2018-09-20 09:54:10  1.971195  true    false    0x55965cca     DemoServiceImpl                sayHello1001    2018-09-20 09:54:11  0.215685  true    false    0x55965cca     DemoServiceImpl                sayHello1002    2018-09-20 09:54:12  0.236303  true    false    0x55965cca     DemoServiceImpl                sayHello1003    2018-09-20 09:54:13  0.159598  true    false    0x55965cca     DemoServiceImpl                sayHello1004    2018-09-20 09:54:14  0.201982  true    false    0x55965cca     DemoServiceImpl                sayHello1005    2018-09-20 09:54:15  0.214205  true    false    0x55965cca     DemoServiceImpl                sayHello1006    2018-09-20 09:54:16  0.241863  true    false    0x55965cca     DemoServiceImpl                sayHello1007    2018-09-20 09:54:17  0.305747  true    false    0x55965cca     DemoServiceImpl                sayHello1008    2018-09-20 09:54:18  0.18468   true    false    0x55965cca     DemoServiceImpl                sayHello
Classloader
  • https://arthas.aliyun.com/doc/classloader

了解當前系統中有多少類加載器,以及每個加載器加載的類數量,幫助您判斷是否有類加載器泄露。

$ classloadername                                                  numberOfInstances  loadedCountTotalBootstrapClassLoader                                  1                  3346com.taobao.arthas.agent.ArthasClassloader             1                  1262java.net.URLClassLoader                               2                  1033org.apache.catalina.loader.ParallelWebappClassLoader  1                  628sun.reflect.DelegatingClassLoader                     166                166sun.misc.Launcher$AppClassLoader                      1                  31com.alibaba.fastjson.util.ASMClassLoader              6                  15sun.misc.Launcher$ExtClassLoader                      1                  7org.jvnet.hk2.internal.DelegatingClassLoader          2                  2sun.reflect.misc.MethodUtil                           1                  1
Web Console
  • https://arthas.aliyun.com/doc/web-console

外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳

Profiler/FlameGraph/火焰圖
  • https://arthas.aliyun.com/doc/profiler
$ profiler start
Started [cpu] profiling
$ profiler stop
profiler output file: /tmp/demo/arthas-output/20211207-111550.html
OK

通過瀏覽器查看profiler結果:

外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳

Arthas Spring Boot Starter
  • Arthas Spring Boot Starter

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/901807.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/901807.shtml
英文地址,請注明出處:http://en.pswp.cn/news/901807.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

機器學習期末

選擇題 以下哪項不是機器學習的類型&#xff1f; A. 監督學習 B.無監督學習 C.半監督學習 D.全監督學習 D 哪一個是機器學習的合理定義? A、機器學習是計算機編程的科學 B、機器學習從標記的數據中學習 C、機器學習是允許機器人智能行動的領域 D、機器學習能使計算機能夠在…

3DMAX粒子流樣條線生成器PFSpliner使用方法詳解

3DMAX粒子流樣條線生成器&#xff0c;是一款功能強大且富有創意的工具。它能夠為“粒子流源”的每一個粒子生成專屬的動畫樣條線&#xff0c;這些樣條線描繪出粒子在空間中的運動軌跡&#xff0c;就如同為粒子繪制出了一條條獨特的“運動地圖”。更為出色的是&#xff0c;這些樣…

Maven中clean、compil等操作介紹和Pom.xml中各個標簽介紹

文章目錄 前言Maven常用命令1.clean2.vaildate3.compile4.test5.package6.verify7.install8.site9.deploy pom.xml標簽詳解格式<?xml version"1.0" encoding"UTF-8"?>(xml版本和編碼)modelVersion&#xff08;xml版本&#xff09;groupId&#xff…

Centos7.6安裝JDK 1.8教程

前提&#xff1a;先把jdk1.8文件上傳到usr/local目錄下&#xff0c;文件名如&#xff1a;jdk-8u151-linux-x64.tar.gz 1. 解壓 JDK 壓縮包 假設 jdk-8u151-linux-x64.tar.gz 文件位于 /usr/local 目錄下。 進入 /usr/local 目錄&#xff1a; cd /usr/local 解壓文件&#…

EuroCropsML:首個面向少樣本時間序列作物分類的多國基準數據集

2025-04-15&#xff0c;由慕尼黑工業大學等機構創建的 EuroCropsML 數據集&#xff0c;這是一個結合了農民報告的作物數據與 Sentinel-2 衛星觀測的時間序列數據集&#xff0c;覆蓋了愛沙尼亞、拉脫維亞和葡萄牙。該數據集為解決遙感應用中作物類型數據空間不平衡問題提供了新的…

將python項目打包成Windows后臺服務

前文,我開發了一個基于windows11與本地deepseek實現的語音助手,之前是通過CMD直接執行項目的main.py文件。但是這樣不適合移植,現在想將其生成一個exe文件,以及部署成windows的后臺服務。 關于語音助手的開發與發布,可以看的CSDN文章:一個基于windows11與本地deepseek實…

yolov8復現

Yolov8的復現流程主要包含環境配置、下載源碼和驗證環境三大步驟&#xff1a; 環境配置 查看電腦狀況&#xff1a;通過任務管理器查看電腦是否有獨立顯卡&#xff08;NVIDIA卡&#xff09;。若有&#xff0c;后續可安裝GPU版本的pytorch以加速訓練&#xff1b;若沒有&#xff0…

Yocto項目實戰教程 · 第4章:4.1小節元數據

&#x1f50d; B站相應的視頻教程&#xff1a; &#x1f4cc; Yocto項目實戰教程-第4章-4.1小節-元數據 記得三連&#xff0c;標為原始粉絲。 在嵌入式Linux系統構建中&#xff0c;Yocto項目憑借其高度模塊化、可配置的特性成為主流工具。而其背后的關鍵支撐之一&#xff0c;便…

《AI大模型應知應會100篇》第23篇:角色扮演技巧:讓AI成為你需要的專家

第23篇&#xff1a;角色扮演技巧&#xff1a;讓AI成為你需要的專家 摘要 在當今人工智能快速發展的時代&#xff0c;大模型已經不僅僅是簡單的問答工具&#xff0c;它們可以通過角色扮演技巧模擬各類專家身份&#xff0c;從而為用戶提供更專業、更有針對性的服務。本文將深入探…

Windows系統安裝RustDesk Server的詳細步驟和客戶端設置

Windows系統安裝RustDesk Server的詳細步驟 在Windows系統上安裝RustDesk Server涉及幾個關鍵步驟,包括安裝必要的依賴、下載RustDesk Server程序、配置并啟動服務。以下是詳細的步驟: 1. 安裝Node.js和PM2 RustDesk Server的某些版本可能需要Node.js環境來運行,而PM2是一…

如何實現一個構造函數繼承另一個構造函數的屬性和方法?給出ES5和ES6兩種方式

在 JavaScript 中&#xff0c;構造函數繼承可以通過 原型鏈 和 構造函數調用 實現。以下是 ES5 和 ES6 的實現方式&#xff1a; ES5 實現方式 關鍵步驟 繼承實例屬性&#xff1a;在子構造函數中調用父構造函數的 call/apply&#xff0c;綁定 this。繼承原型方法&#xff1a;將…

AWS Redshift的使用場景及一些常見問題

Redshift 不是關系型數據庫, 提供了Amazon Redshift Serverless 和 Amazon Redshift 都是構建于 Redshift 數倉引擎之上的&#xff0c;但它們適用的場景不同。Redshift和Dynamodb都可以存儲數據, 分別怎么選擇? 這里記錄一些常見的問題和場景。 1. 如何選擇用Amazon Redshift…

十五種光電器件綜合對比——《器件手冊--光電器件》

十五、光電器件 名稱 原理 特點 應用 發光二極管&#xff08;LED&#xff09; 基于半導體材料的電致發光效應&#xff0c;當電流通過時&#xff0c;電子與空穴復合&#xff0c;釋放出光子。 高效、節能、壽命長、響應速度快、體積小。 廣泛用于指示燈、照明、顯示&#…

Electricity Market Optimization(VI) - 機組組合模型以及 Gurobi 求解

本文參考鏈接&#xff1a;link \hspace{1.6em} 機組組合問題在電力系統中非常重要&#xff0c;這個問題也是一個優化問題&#xff0c;研究的就是如何調度現有的機組&#xff0c;調度的對象是以煤炭、石油、天然氣為燃料的火力發電機以及水力發電機等可預測處理的發電機組&#…

linux多線(進)程編程——(8)多進程的沖突問題

前言 隨著時間的推移&#xff0c;共享內存已經在修真界已經淪為禁術。因為使用這種方式溝通的兩人往往會陷入到走火入魔的狀態&#xff0c;思維扭曲。進程君父子見到這種情況&#xff0c;連忙開始專研起來&#xff0c;終于它們發現了共享內存存在的問題&#xff1a; 進程間沖…

網絡層IP協議知識大梳理

全是通俗易懂的講解&#xff0c;如果你本節之前的知識都掌握清楚&#xff0c;那就速速來看我的IP協議筆記吧~ 自己寫自己的八股&#xff01;讓未來的自己看懂&#xff01; &#xff08;全文手敲&#xff0c;受益良多&#xff09; 網路基礎3 網路層 TCP并沒有把數據發到網路…

數據結構與算法學習導航

目錄 指導思想資料總結代碼隨想錄hello-algoOI-WIKI 一名麻瓜的刷leetcode的簡單概述。 在這里對過去的自己說: 如果你相信算法有用你就刷刷leetcode&#xff0c;如果不相信面試會讓你相信。 當然&#xff0c;現在我確實認為算法和數據結構有用&#xff0c;leetcode也有用。 …

【網絡安全】誰入侵了我的調制解調器?(二)

文章目錄 針對 TR-069 協議 REST API 的攻擊思路攻擊百萬臺調制解調器意外發現 Cox 后端 API 的授權繞過漏洞確認我們能夠進入任何人的設備訪問和更新任何Cox商業客戶賬戶通過泄露的加密密鑰覆蓋任何人的設備設置執行對任何調制解調器的命令影響最后想說閱讀本文前,請先行瀏覽…

大模型在急性單純性闌尾炎預測及治療方案制定中的應用研究

目錄 一、引言 1.1 研究背景與意義 1.2 研究目的 1.3 研究方法與創新點 二、急性單純性闌尾炎概述 2.1 定義與發病機制 2.2 臨床表現 2.3 傳統診斷方法 三、大模型在急性單純性闌尾炎預測中的應用 3.1 大模型簡介 3.2 數據收集與處理 3.3 模型訓練與優化 3.4 預測…

Linux 上安裝和配置 VNC 遠程桌面

在 Linux 上安裝和配置 VNC&#xff08;Virtual Network Computing&#xff09;可以讓你遠程訪問圖形化桌面環境。以下是詳細的安裝和配置步驟&#xff0c;適用于主流 Linux 發行版&#xff08;如 Ubuntu、CentOS、Debian 等&#xff09;。 1. 安裝 VNC 服務器 Ubuntu/Debian …