首页 文章 精选 留言 我的

精选列表

搜索[http服务器],共10034篇文章
优秀的个人博客,低调大师

CentOS7设置SWAP分区,小内存服务器的救世主

前言 Swap分区在系统的物理内存(这里应该是运行内存)不够用的时候,把物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap分区中,等到那些程序要运行时,再从Swap分区中恢复保存的数据到内存中。 设置 1.添加SWAP分区 sh 复制代码 cd / && dd if=/dev/zero of=swapfile bs=1024 count=4194304 chmod 600 /swapfile && mkswap /swapfile swapon /swapfile && swapon -s echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 注: count=4194304中4194304为交换分区大小 4194304=102410244大小为4G 交换区大小设置有个参考依据,物理内存小于4G则SWAP设置为物理内存的两倍、物理内存等于4G则SWAP设置为4G、物理内存大于4G则SWAP设置为物理内存的1/2。 2.重启系统 sh 复制代码 shutdown -r now 3.查看分区结果 sh 复制代码 free -m 4.关闭交换空间 sh 复制代码 cd / && swapoff swapfile && rm -rf swapfile

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

Pike 4.1.0 版本发版 —— HTTP 缓存服务器

Pike 4.1.0版本正式发布,支持更多的种类的持久化存储,如:redis、mongodb等。主要的特性如下: 提供WEB的管理配置界面,简单易上手 支持br与gzip两种压缩方式,根据客户端自动选择。对于可缓存与不可缓存请求使用不同的压缩配置,更佳的时间与空间的平衡 仅基于Cache-Control生成缓存有效期,接口缓存完全由接口开发者决定,准确而高效(开发比运维更清楚接口是否可缓存,可缓存时长) 配置支持文件与etcd两种形式存储,无中断的配置实时更新 支持H2C的转发,提升与后端服务的调用性能(如果是内网转发,不需要启用) 与upstream的调用支持gzip,brotli,lz4,snappy以及zstd压缩,可根据与upstream的网络线路选择合适的压缩方式 支持upstream检测失败时回调告警,可及时获取异常upstream信息 支持自定义日志,可配置按日期与大小分割日志并压缩 LUR与持久化存储(可选)配合使用,可根据内存使用选择更小的LRU缓存并增加持久化存储的方式 持久化存储支持以下形式:badger(文件)、redis以及mongodb

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

Java工具类之在服务器发送HTTP请求

版权声明:本文为博主原创文章,未经博主允许不得转载。博客源地址为zhixiang.org.cn https://blog.csdn.net/myFirstCN/article/details/80880234 使用之前首先添加maven依赖或者是jar包 <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency> 下面给出工具类代码,一个简单发送Get和Post请求的例子 public class HttpUtils { /* *发送简单post请求 */ public static JSONObject post(String url) { HttpPost post = new HttpPost(url); return getResult(post); } /* *发送带Header的post请求 */ public static JSONObject post(String url, Map<String, String> map) { HttpPost post = new HttpPost(url); if (!map.isEmpty()) { Set<Map.Entry<String, String>> entrys = map.entrySet(); for (Map.Entry<String, String> entry : entrys) { post.setHeader(entry.getKey(), entry.getValue()); } } return getResult(post); } /* *发送带Header的get请求 */ public static JSONObject get(String url, Map<String, String> map) { HttpGet get = new HttpGet(url); if (!map.isEmpty()) { Set<Map.Entry<String, String>> entrys = map.entrySet(); for (Map.Entry<String, String> entry : entrys) { get.setHeader(entry.getKey(), entry.getValue()); } } return getResult(get); } /* *发送简单的get请求 */ public static JSONObject get(String url) { HttpGet get = new HttpGet(url); return getResult(get); } /* *发送请求方法,请求响应为JSONObject */ private static JSONObject getResult(HttpRequestBase requestBase) { CloseableHttpClient httpClient = HttpClients.createDefault(); String result = null; try { result = EntityUtils.toString(httpClient.execute(requestBase).getEntity()); httpClient.close(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { return new JSONObject(JSON.parseObject(result)); } } /* *当请求响应为String时 */ public static String getString(String url) { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpGet get = new HttpGet(url); String result = null; try { result = EntityUtils.toString(httpClient.execute(get).getEntity()); httpClient.close(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { return result; } } } 使用之前首先添加maven依赖或者是jar包 <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency> 下面给出工具类代码,一个简单发送Get和Post请求的例子 public class HttpUtils { /* *发送简单post请求 */ public static JSONObject post(String url) { HttpPost post = new HttpPost(url); return getResult(post); } /* *发送带Header的post请求 */ public static JSONObject post(String url, Map<String, String> map) { HttpPost post = new HttpPost(url); if (!map.isEmpty()) { Set<Map.Entry<String, String>> entrys = map.entrySet(); for (Map.Entry<String, String> entry : entrys) { post.setHeader(entry.getKey(), entry.getValue()); } } return getResult(post); } /* *发送带Header的get请求 */ public static JSONObject get(String url, Map<String, String> map) { HttpGet get = new HttpGet(url); if (!map.isEmpty()) { Set<Map.Entry<String, String>> entrys = map.entrySet(); for (Map.Entry<String, String> entry : entrys) { get.setHeader(entry.getKey(), entry.getValue()); } } return getResult(get); } /* *发送简单的get请求 */ public static JSONObject get(String url) { HttpGet get = new HttpGet(url); return getResult(get); } /* *发送请求方法,请求响应为JSONObject */ private static JSONObject getResult(HttpRequestBase requestBase) { CloseableHttpClient httpClient = HttpClients.createDefault(); String result = null; try { result = EntityUtils.toString(httpClient.execute(requestBase).getEntity()); httpClient.close(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { return new JSONObject(JSON.parseObject(result)); } } /* *当请求响应为String时 */ public static String getString(String url) { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpGet get = new HttpGet(url); String result = null; try { result = EntityUtils.toString(httpClient.execute(get).getEntity()); httpClient.close(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } finally { return result; } } }

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

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

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册