首页 文章 精选 留言 我的

精选列表

搜索[系统],共10000篇文章
优秀的个人博客,低调大师

kali下配置conky,实现桌面美化监控系统

版权声明:转载请注明出处:http://blog.csdn.net/dajitui2024 https://blog.csdn.net/dajitui2024/article/details/79396653 更多参考:1、https://bbs.deepin.org/forum.php?mod=viewthread&tid=28762&extra=2、https://bbs.deepin.org/forum.php?mod=viewthread&tid=36296&extra= sudo apt-get install conky -y 安装conky vim /root/.conkyrc 配置conky 配置内容如下: # set to yes if you want Conky to be forked in the background background no cpu_avg_samples 2 net_avg_samples 2 out_to_console no # X font when Xft is disabled, you can pick one with program xfontsel #font 7x12 #font 6x10 #font 7x13 #font 8x13 #font 7x12 #font *mintsmild.se* #font -*-*-*-*-*-*-34-*-*-*-*-*-*-* #font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1 # Use Xft? use_xft yes # Xft font when Xft is enabled xftfont Sans:size=8 own_window_argb_visual yes #own_window_colour hotpink # Text alpha when using Xft xftalpha 0.8 # on_bottom yes # mail spool mail_spool $MAIL # Update interval in seconds update_interval 1 # Create own window instead of using desktop (required in nautilus) own_window yes own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager #own_window_type override own_window_type normal # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # Minimum size of text area minimum_size 260 5 maximum_width 400 # Draw shades? draw_shades no # Draw outlines? draw_outline no # Draw borders around text draw_borders no # Stippled borders? stippled_borders no # border margins border_margin 4 # border width border_width 1 # Default colors and also border colors default_color white default_shade_color white default_outline_color white # Text alignment, other possible values are commented #alignment top_left #minimum_size 10 10 gap_x 15 gap_y 20 alignment top_right #alignment bottom_left #alignment bottom_right # Gap between borders of screen and text # Add spaces to keep things from moving about? This only affects # certain objects. use_spacer none # Subtract file system buffers from used memory? no_buffers yes # set to yes if you want all text to be in uppercase uppercase no # none, xmms, bmp, audacious, infopipe (default is none) # xmms_player bmp TEXT ${color white}SYSTEM ${hr 1}${color} Time:$alignr${time %Y.%m.%d}$alignc ${time %H:%M:%S}$alignr Week:${time %w} Hostname: $alignr$nodename Kernel: $alignr$kernel Machine:$alignr$machine Uptime: $alignr$uptime Temp: ${alignr}${acpitemp} °C Battery:$alignr${battery BAT0} #Battery:$alignr${battery_percent BAT0}% CPU: ${alignr}${freq dyn} MHz Processes: ${alignr}$processes ($running_processes running) Load: ${alignr}$loadavg CPU1 ${alignr}${cpu cpu1}% ${cpubar 4 cpu1} CPU2 ${alignr}${cpu cpu2}% ${cpubar 4 cpu2} Ram ${alignr}$mem / $memmax ($memperc%) ${membar 4} swap ${alignr}$swap / $swapmax ($swapperc%) ${swapbar 4} Highest CPU $alignr CPU% MEM% ${top name 1}$alignr${top cpu 1} ${top mem 1} ${top name 2}$alignr${top cpu 2} ${top mem 2} ${top name 3}$alignr${top cpu 3} ${top mem 3} Highest MEM $alignr CPU% MEM% ${top_mem name 1}$alignr${top_mem cpu 1} ${top_mem mem 1} ${top_mem name 2}$alignr${top_mem cpu 2} ${top_mem mem 2} ${top_mem name 3}$alignr${top_mem cpu 3} ${top_mem mem 3} ${color white}FILE SYSTEM ${hr 1}${color} Root: ${alignr}${fs_free /} / ${fs_size /} ${fs_bar 4 /} Home: ${alignr}${fs_free /home} / ${fs_size /home} ${fs_bar 4 /home} ${color white}NETWORK ${hr 1}${color} Down ${downspeed eth0} k/s ${alignr}Up ${upspeed eth0} k/s ${downspeedgraph eth0 25,107} ${alignr}${upspeedgraph eth0 25,107} Total ${totaldown eth0} ${alignr}Total ${totalup eth0} #${color white}NEWS $color #${rss http://www.linuxeden.com/plus/rss.php?tid=1 5 item_titles 2} 效果如图 启动工具 root@kali:/opt# cat cokyrun.sh #!/bin/bash /usr/bin/conky &

优秀的个人博客,低调大师

Java系统高并发之Redis后端缓存优化

一:前端优化 暴露接口,按钮防重复(点击一次按钮后就变成禁用,禁止重复提交) 采用CDN存储静态化的页面和一些静态资源(css,js等) 二:Redis后端缓存优化 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库。 Redis支持数据的持久化,可以将内存中的数据保存在磁盘中,重启的时候可以再次加载进行使用。 性能极高 – Redis能读的速度是110000次/s,写的速度是81000次/s 。 原子 – Redis的所有操作都是原子性的,意思就是要么成功执行要么失败完全不执行。 利用Redis可以减轻MySQL服务器的压力,减少了跟数据库服务器的通信次数。 2.1 Redis服务端下载以及安装 详细步骤参考:Redis服务端安装教程 注:以下pom.xml为Maven项目配置文件,若非Maven项目,百度相应名称包导入即可。 2.2 在pom.xml中配置Redis客户端 <!-- redis客户端:Jedis --> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.7.3</version> </dependency> 由于Jedis并没有实现内部序列化操作,而Java内置的序列化机制性能又不高,我们需要考虑高并发优化,在这里我们采用开源社区提供的更高性能的自定义序列化工具protostuff。 2.3 在pom.xml中配置protostuff依赖 <!-- protostuff序列化依赖 --> <dependency> <groupId>com.dyuproject.protostuff</groupId> <artifactId>protostuff-core</artifactId> <version>1.0.8</version> </dependency> <dependency> <groupId>com.dyuproject.protostuff</groupId> <artifactId>protostuff-runtime</artifactId> <version>1.0.8</version> </dependency> 2.4 使用Redis优化数据库访问 流程:先去Redis缓存中查询,以此降低数据库的压力。如果在缓存中查询不到数据再去数据库中查询,再将查询到的数据放入Redis缓存中,这样下次就可以直接去缓存中直接查询到。 推荐:新建dao.cache包,实现RedisDao类。例子中缓存实体类名为Seckill.class。例子: 使用protostuff序列化工具时,被序列化的对象必须是pojo对象(具备setter/getter) import com.dyuproject.protostuff.LinkedBuffer; import com.dyuproject.protostuff.ProtostuffIOUtil; import com.dyuproject.protostuff.runtime.RuntimeSchema; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; /* * Redis可以近似理解为Map<Key,Value>对象 */ public class RedisDao { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final JedisPool jedisPool; public RedisDao(String ip, int port) { jedisPool = new JedisPool(ip, port); } private RuntimeSchema<Seckill> schema = RuntimeSchema.createFrom(Seckill.class); public Seckill getSeckill(long seckillId) { // redis操作逻辑 try { Jedis jedis = jedisPool.getResource(); try { String key = "seckill:" + seckillId; // 并没有实现内部序列化操作 // get-> byte[] -> 反序列化 ->Object(Seckill) // 采用自定义序列化 // protostuff : pojo. byte[] bytes = jedis.get(key.getBytes());//根据Key获取Value // 缓存中获取到bytes if (bytes != null) { // 空对象 Seckill seckill = schema.newMessage(); ProtostuffIOUtil.mergeFrom(bytes, seckill, schema); // seckill 被反序列化 return seckill; } } finally { jedis.close(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return null; } public String putSeckill(Seckill seckill) { // set Object(Seckill) -> 序列化 -> byte[] try { Jedis jedis = jedisPool.getResource(); try { String key = "seckill:" + seckill.getSeckillId();//保存Value的Key byte[] bytes = ProtostuffIOUtil.toByteArray(seckill, schema, LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BUFFER_SIZE)); // 超时缓存 int timeout = 60 * 60;// 1小时 String result = jedis.setex(key.getBytes(), timeout, bytes); return result; } finally { jedis.close(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return null; } } 在使用该RedisDao对象时,需要传入Ip地址和端口。 new RedisDao("localhost","6379"); 若使用Spring ICO容器,需配置: <!--redisDao --> <bean id="redisDao" class="换成你的包dao.cache.RedisDao"> <constructor-arg index="0" value="localhost" /> <constructor-arg index="1" value="6379" /> </bean> 测试Demo: Seckill seckill = redisDao.getSeckill(id); if (seckill == null) { seckill = seckillDao.queryById(id); if (seckill != null) { String result = redisDao.putSeckill(seckill); System.out.pritln(result); seckill = redisDao.getSeckill(id); System.out.pritln(result); } }

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册