当前位置: 首页 > news >正文

json数据传输压缩以及数据切片分割分块传输多种实现方法,大数据量情况下zlib压缩以及bytes指定长度分割

json数据传输压缩以及数据切片分割分块传输多种实现方法,大数据量情况下zlib压缩以及bytes指定长度分割。

import sys
import zlib
import json
import mathKAFKA_MAX_SIZE = 1024 * 1024
CONTENT_MIN_MAX_SIZE = KAFKA_MAX_SIZE * 0.9def split_data(data):""":param data: json:return:"""# 先进行压缩data = zlib.compress(json.dumps(data).encode('utf-8'))part_content = b""content_list = []data_length = len(data)data_size = sys.getsizeof(data)step = math.ceil(data_length / ((data_size / CONTENT_MIN_MAX_SIZE) + 1))  # 计算切割的长度for i in range(0, len(data), step):default_content = part_contentpart_content += data[i:i + step]cur_part_content_size = sys.getsizeof(part_content)# 限制每个分片在 0.9M 到 1M 之间if CONTENT_MIN_MAX_SIZE < cur_part_content_size < KAFKA_MAX_SIZE:content_list.append(part_content)part_content = b""elif KAFKA_MAX_SIZE < cur_part_content_size:content_list.append(default_content)part_content = data[i:i + step]if part_content:content_list.append(part_content)return content_listdef split_data2(data):""":param data: json:return:"""# 先进行压缩data = zlib.compress(json.dumps(data).encode('utf-8'))data_length = len(data)step = int(CONTENT_MIN_MAX_SIZE)content_list = [data[i:i + step] for i in range(0, data_length, step)]return content_listdef split_data3(data):""":param data: json:return:"""# 先进行压缩data = zlib.compress(json.dumps(data).encode('utf-8'))import restep = int(CONTENT_MIN_MAX_SIZE)last = data[int((len(data) / step)) * step:]content_list = re.findall(bytes("[\s\S]{" + str(step) + "}", encoding="utf8"), data)content_list.append(last)return content_listdef re_j_data(content_list):# 还原成jsoncur_content = b""for item in content_list:cur_content += itemdata = json.loads(zlib.decompress(cur_content))return dataif __name__ == '__main__':test_data = {"domain": "uoowoo.cn","ip": "122.10.52.140","ip_version": 4,"port": 443,"path": "/","url": "https://uoowoo.cn/","protocol": "https","transport": "tcp","date": 1624346530364,"status_code": 200,"header": 'HTTP/1.1 200 OK\\r\\nServer: nginx\\r\\nDate: Tue, 22 Jun 2021 07:22:09 GMT\\r\\nContent-Type: text/html\\r\\nLast-Modified: Fri, 11 Jun 2021 10:25:32 GMT\\r\\nTransfer-Encoding: chunked\\r\\nVary: Accept-Encoding\\r\\nETag: W/\\"60c33a1c-1ba9\\"\\r\\nContent-Encoding: gzip\\r\\nConnection: close\\r\\n\\r\\n',"body": "PCFkb2N0eXBlIGh0bWw+DQo8aHRtbCBsYW5nPSJ6aC1DTiI+DQogICA8aGVhZD4NCiAgICAgIDxtZXRhIGNoYXJzZXQ9IlVURi04Ii8+DQogICAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLGluaXRpYWwtc2NhbGU9MSxtYXhpbXVtLXNjYWxlPTEsdXNlci1zY2FsYWJsZT1ubyIvPg0KICAgICAgPG1ldGEgbmFtZT0iZm9ybWF0LWRldGVjdGlvbiIgY29udGVudD0idGVsZXBob25lPW5vIj4NCiAgICAgIDx0aXRsZT5PROS9k+iCsjwvdGl0bGU+DQogICAgICA8bWV0YSBuYW1lPSJrZXl3b3JkcyIgY29udGVudD0iT0TkvZPogrIiLz4NCiAgICAgIDxtZXRhIG5hbWU9ImRlc2NyaXB0aW9uIiBjb250ZW50PSJPROS9k+iCsiIvPg0KICAgICAgPGxpbmsgcmVsPSJzaG9ydGN1dCBpY29uIiBocmVmPSIuL2ltYWdlcy9mYXZpY29uLmljbyIvPg0KICAgICAgPHNjcmlwdCBzcmM9Ii4vanMvaW5kZXguanMiPjwvc2NyaXB0Pg0KICAgICAgPGxpbmsgaHJlZj0iLi9jc3Mvb2RTcG9ydHMuY3NzIiByZWw9InN0eWxlc2hlZXQiPg0KICAgPC9oZWFkPg0KICAgPGJvZHk+DQogICAgICA8ZGl2IGNsYXNzPSJkb3dubG9hZC1wYWdlIiBpZD0iYXBwIj4NCiAgICAgICAgIDxkaXYgY2xhc3M9ImRvd25sb2FkLWJ0biI+PGltZyBjbGFzcz0iZG93bmxvYWQtaGVh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zPSJ0aXRsZTEiPjxpbWcgc3JjPSIuL2ltYWdlcy9vZF9zcG9ydHMvbGVmdC5wbmciLz4gPHNwYW4+6aaW5a2Y6LGq56S8PC9zcGFuPiA8aW1nIHNyYz0iLi9pbWFnZXMvb2Rfc3BvcnRzL3JpZ2h0LnBuZyIvPjwvZGl2Pg0KICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0iY29udGVudC1ib3giPg0KICAgICAgICAgICAgICAgICAgPHRhYmxlPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRoPummluWtmDwvdGg+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGg+5b2p6YeRPC90aD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+NTAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4xMjg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4xMDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yNjg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yMDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4zODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD41MDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD42ODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4xMDAwMDwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+MTI4ODwvdGQ+DQogICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjIwMDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4xNjg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+NTAwMDA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjI4ODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4xMDAwMDA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjU4ODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yMDAwMDA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjg4ODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgIDwvdGFibGU+DQogICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJjb250ZW50LXRpcHMiPg0KICAgICAgICAgICAgICAgICAgICAgPHA+5rOo77ya6aaW5a2Y5Y2z6YCB77yM5L2T6IKyLOeUteerniAx5YCN5rWB5rC05o+Q546w77yM5YW25LuW5Zy66aaGM+WAjea1geawtOaPkOasvjwvcD4NCiAgICAgICAgICAgICAgICAgICAgIDxwPjwvcD4NCiAgICAgICAgICAgICAgICAgIDwvZGl2Pg0KICAgICAgICAgICAgICAgPC9kaXY+DQogICAgICAgICAgICA8L2Rpdj4NCiAgICAgICAgICAgIDxkaXYgY2xhc3M9ImRvd25sb2FkLWJhY2tncm91bmQxIj4NCiAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9InRpdGxlMSI+PGltZyBzcmM9Ii4vaW1hZ2VzL29kX3Nwb3J0cy9sZWZ0LnBuZyIvPiA8c3Bhbj7pppblrZjlj4zlgI3osarnpLw8L3NwYW4+IDxpbWcgc3JjPSIuL2ltYWdlcy9vZF9zcG9ydHMvcmlnaHQucG5nIi8+PC9kaXY+DQogICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJjb250ZW50LWJveCI+DQogICAgICAgICAgICAgICAgICA8dGFibGU+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGg+6aaW5a2YPC90aD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0aD7lvanph5E8L3RoPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRoPuimgeaxgjwvdGg+DQogICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjEwMDwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+MTAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZCByb3dzcGFuPSIzIj7kvZPogrLnlLXnq54z5YCN5rWB5rC077yM5YW25LuW5Zy66aaGNeWAjea1geawtDwvdGQ+DQogICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjEyMDA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjEyMDA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yMDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yMDAwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICA8L3RhYmxlPg0KICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0iY29udGVudC10aXBzIj4NCiAgICAgICAgICAgICAgICAgICAgIDxwPuazqO+8muW9qemHkeWIhjTmrKHotaDpgIHvvIznrKzkuIDmrKHnq4vljbPliLDotKblvanph5HmgLvmlbA05YiG5LmLMe+8jOS5i+WQjuavj+WRqOmihuWPluS4gOasoTItMy005qyh6ZyA6KaB5omT5aSf6aaW5a2YM+WAjeS7peS4iueahOS9k+iCsueUteernua1geawtO+8jOWFtuS7luWcuummhua1geawtOi+vuWIsDXlgI3ljbPlj6/nlLPor7flvanph5HjgILvvIgxMDDpgIExMDDliIbkuKTmrKHotaDpgIHvvIk8L3A+DQogICAgICAgICAgICAgICAgICAgICA8cD48L3A+DQogICAgICAgICAgICAgICAgICA8L2Rpdj4NCiAgICAgICAgICAgICAgIDwvZGl2Pg0KICAgICAgICAgICAgPC9kaXY+DQogICAgICAgICAgICA8ZGl2IGNsYXNzPSJkb3dubG9hZC1iYWNrZ3JvdW5kMSI+DQogICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJ0aXRsZTEiPjxpbWcgc3JjPSIuL2ltYWdlcy9vZF9zcG9ydHMvbGVmdC5wbmciLz4gPHNwYW4+5ZG85pyL5ZSk5Y+LIOWdkOS6q+WFtuaIkDwvc3Bhbj4gPGltZyBzcmM9Ii4vaW1hZ2VzL29kX3Nwb3J0cy9yaWdodC5wbmciLz48L2Rpdj4NCiAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9InN1Yi10aXRsZSI+PGltZyBzcmM9Ii4vaW1hZ2VzL29kX3Nwb3J0cy9pY29uLXN1YnRpdGxlLnBuZyI+6LGq56S85LiAPC9kaXY+DQogICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJjb250ZW50LWltZyI+PGltZyBzcmM9Ii4vaW1hZ2VzL29kX3Nwb3J0cy9oYW9saTEucG5nIiBhbHQ9IiI+PC9kaXY+DQogICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJzdWItdGl0bGUiPjxpbWcgc3JjPSIuL2ltYWdlcy9vZF9zcG9ydHMvaWNvbi1zdWJ0aXRsZS5wbmciPuixquekvOS6jDwvZGl2Pg0KICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0iY29udGVudC1ib3giPg0KICAgICAgICAgICAgICAgICAgPHRhYmxlPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRoPuaci+WPi+i0puWPt+WNh+e6pzwvdGg+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGg+5Y2H57qn5b2p6YeRPC90aD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+VklQMzwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+MTg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+VklQNDwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+Njg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+VklQNTwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+ODg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+VklQNjwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+MTI4ODwvdGQ+DQogICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPlZJUDc8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPjE4ODg8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgIDx0cj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD5WSVA4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD4yODg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+VklQOTwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGQ+Mzg4ODwvdGQ+DQogICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHRkPlZJUDEwPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0ZD42ODg4PC90ZD4NCiAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICA8L3RhYmxlPg0KICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0iY29udGVudC10aXBzLWJpZyI+DQogICAgICAgICAgICAgICAgICAgICA8cD425pyIMeaXpei1t+iHs+asp+a0suadr+e7k+adn+a0vuWPkTwvcD4NCiAgICAgICAgICAgICAgICAgIDwvZGl2Pg0KICAgICAgICAgICAgICAgPC9kaXY+DQogICAgICAgICAgICA8L2Rpdj4NCiAgICAgICAgICAgIDxkaXYgY2xhc3M9ImRvd25sb2FkLWJhY2tncm91bmQxIj4NCiAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9InRpdGxlMSI+PGltZyBzcmM9Ii4vaW1hZ2VzL29kX3Nwb3J0cy9sZWZ0LnBuZyIvPiA8c3Bhbj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WXKSrvKnseXBakZxt4LSX9lPhCaGSoTSg6hGYiBTwN0sdrDeyT/hxEKgssHX7FlknkyIkks3nfyBNpS+Z9xA9nlZjBd4DhjOSjzxMKU2iFv3XxYJRkD0Kr3isr7hPsTkJ8QkNPedM/B4Qa2Fvm9Q/KJDwQDKXa5KTydCqsioHNFsSwIxImhTNRQFjQrQZO5PBlkah2+N5caLkdwQ/ZWPCeBiwFP7EpIlnkb7+LDPawOYWJaHDdDGoI8RLGSf0/Dt36YTWdht02ourIk7Dp1WzHyfe8Y3plXyZgixoFQZ10iqaEbDycOmRmt6r/aIB//tDTJe9hvDsFuDmLhnAmnEeKgx8lH4b8U8y9pPjqeWY4jsSHWbke94ozV3knA0qN3W3EDKVwVDolg/zcufNMj70/5NR+B2gThoXxtqe6UP4/rr8FpBu5ra7rpveOVHf2j7Ci0q6bxVgiriYOd76fx4mJgtLH1wHroBmob/8XOcJVfWA87MpQu2425K/5z9731SdpANJTiQc2isAAAA=","md5": "6952cdb01830c5028a71ccb43d6dec29","sha1": "9f74d81425b41e8f7dcb9cbade674ee8b0c6cb45","timestamp": 1624346530364}],"crawler": "platinum-0.4","crawler_ip": "8.210.150.89","datasource": "srccz2","echo": '{"host": "uoowoo.cn", "task_sdate": "2021-06-16", "task_type": "bigironrod_crawler"}'}import timet1 = time.time()cur_content_list = split_data(test_data)print(len(cur_content_list))for s in cur_content_list:print(type(s))print(sys.getsizeof(s))result = re_j_data(cur_content_list)t2 = time.time()print(t2 - t1)print(result["ip"])print(result["header"])# =========================================t1 = time.time()cur_content_list = split_data2(test_data)print(len(cur_content_list))for s in cur_content_list:print(type(s))print(sys.getsizeof(s))result = re_j_data(cur_content_list)t2 = time.time()print(t2 - t1)print(result["ip"])print(result["header"])# =========================================t1 = time.time()cur_content_list = split_data3(test_data)print(len(cur_content_list))for s in cur_content_list:print(type(s))print(sys.getsizeof(s))result = re_j_data(cur_content_list)t2 = time.time()print(t2 - t1)print(result["ip"])print(result["header"])

测试结果(三种方法性能相近):

12
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
859815
<class 'bytes'>
209455
10.14835000038147
122.10.52.140
HTTP/1.1 200 OK\r\nServer: nginx\r\nDate: Tue, 22 Jun 2021 07:22:09 GMT\r\nContent-Type: text/html\r\nLast-Modified: Fri, 11 Jun 2021 10:25:32 GMT\r\nTransfer-Encoding: chunked\r\nVary: Accept-Encoding\r\nETag: W/\"60c33a1c-1ba9\"\r\nContent-Encoding: gzip\r\nConnection: close\r\n\r\n
11
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
229877
10.214266061782837
122.10.52.140
HTTP/1.1 200 OK\r\nServer: nginx\r\nDate: Tue, 22 Jun 2021 07:22:09 GMT\r\nContent-Type: text/html\r\nLast-Modified: Fri, 11 Jun 2021 10:25:32 GMT\r\nTransfer-Encoding: chunked\r\nVary: Accept-Encoding\r\nETag: W/\"60c33a1c-1ba9\"\r\nContent-Encoding: gzip\r\nConnection: close\r\n\r\n
11
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
943751
<class 'bytes'>
229877
10.125932216644287
122.10.52.140
HTTP/1.1 200 OK\r\nServer: nginx\r\nDate: Tue, 22 Jun 2021 07:22:09 GMT\r\nContent-Type: text/html\r\nLast-Modified: Fri, 11 Jun 2021 10:25:32 GMT\r\nTransfer-Encoding: chunked\r\nVary: Accept-Encoding\r\nETag: W/\"60c33a1c-1ba9\"\r\nContent-Encoding: gzip\r\nConnection: close\r\n\r\nProcess finished with exit code 0

相关文章:

json数据传输压缩以及数据切片分割分块传输多种实现方法,大数据量情况下zlib压缩以及bytes指定长度分割

json数据传输压缩以及数据切片分割分块传输多种实现方法&#xff0c;大数据量情况下zlib压缩以及bytes指定长度分割。 import sys import zlib import json import mathKAFKA_MAX_SIZE 1024 * 1024 CONTENT_MIN_MAX_SIZE KAFKA_MAX_SIZE * 0.9def split_data(data):"&q…...

移动端APP测试-如何指定测试策略、测试标准?

制定项目的测试策略是一个重要的步骤&#xff0c;可以帮助测试团队明确测试目标、测试范围、测试方法、测试资源、测试风险等&#xff0c;从而提高测试效率和质量。本篇是一些经验总结&#xff0c;理论分享。并不是绝对正确的&#xff0c;也欢迎大家一起讨论。 文章目录 一、测…...

【Redis】深入探索 Redis 主从结构的创建、配置及其底层原理

文章目录 前言一、对 Redis 主从结构的认识1.1 什么是主从结构1.2 主从结构解决的问题 二、主从结构创建2.1 配置并建立从节点2.2.1 从节点配置文件2.2.2 启动并连接 Redis 主从节点2.2.3 SLAVEOF 命令2.2.4 断开主从关系 2.2 查看主从节点的信息2.2.1 INFO REPLICATION 命令2.…...

CSS 滚动驱动动画 scroll-timeline ( scroll-timeline-name ❤️ scroll-timeline-axis )

scroll-timelinescroll-timeline-name❤️scroll-timeline-axis 解决问题语法 animation-timeline-nameanimation-timeline-axis scroll-timeline ( scroll-timeline-name ❤️ scroll-timeline-axis ) 在 scroll() 的最后我们遇到了因为定位问题导致滚动效果失效的情况, 当…...

9.19号作业

2> 完成文本编辑器的保存工作 widget.h #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QFontDialog> #include <QFont> #include <QMessageBox> #include <QDebug> #include <QColorDialog> #include <QColor&g…...

Mybatis学习笔记9 动态SQL

Mybatis学习笔记8 查询返回专题_biubiubiu0706的博客-CSDN博客 动态SQL的业务场景&#xff1a; 例如 批量删除 get请求 uri?id18&id19&id20 或者post id18&id19&id20 String[] idsrequest.getParameterValues("id") 那么这句SQL是需要动态的 还…...

element表格 和后台联调

1.配置接口 projectList:/api/goods/xxx,//产品列表2.请求接口(get请求默认参数page) // 产品列表 pageprojectList(params){return axios.get(base.projectList,{params})}3.获取数据 直接放到created里边去了 刷新页面就可以看到 async projectList(page){let res await t…...

基于SSM的智慧城市实验室主页系统的设计与实现

末尾获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;SSM 前端&#xff1a;采用Vue技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xff1a;IDEA / Eclipse 是否Maven项目&#x…...

怒赞,阿里P8推荐的Java面试宝典:41个专题PDF(史上最全+面试必备)

《尼恩Java面试宝典》 40岁老架构师 尼恩 经过对大量 Java面试题 的不断梳理、迭代&#xff0c; 编著成5000页的《尼恩Java面试宝典》&#xff0c;致力于体系化&#xff0c; 系统化&#xff0c;形象化 梳理&#xff0c;形成一个大的知识体系&#xff0c;从而帮助大家 进大厂&a…...

线程池各个参数设置说明

1. corePoolSize 核心线程数 看处理业务属于IO密集型还是属于cpu密集型IO密集型: 通常设置为N1&#xff0c;还有一个计算公式&#xff1a;线程数 cpu数*&#xff08;线程等待时间/线程总的处理时间&#xff09; 但是由于服务器除了这个服务可能还部署有其他服务&#xff0c;…...

springBoot对接多个mq并且实现延迟队列---未完待续

mq调用流程 创建消息转换器 package com.wd.config;import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.context.annotation.Bean; import o…...

Pytorch从零开始实战04

Pytorch从零开始实战——猴痘病识别 本系列来源于365天深度学习训练营 原作者K同学 文章目录 Pytorch从零开始实战——猴痘病识别环境准备数据集模型选择模型训练数据可视化其他模型图片预测 环境准备 本文基于Jupyter notebook&#xff0c;使用Python3.8&#xff0c;Pytor…...

北大C++课后记录:文件读写的I/O流

前言 文件和平常用到的cin、cout流其实是一回事&#xff0c;可以将文件看作一个有限字符构成的顺序字符流&#xff0c;基于此&#xff0c;也可以像cin、cout读键盘数据那样对文件进行读写。 读写指针 输入流的read指针 输出流的write指针 注&#xff1a;这里的指针并不是普…...

详解Linux的grep命令

2023年9月19日&#xff0c;周二晚上 先写这么多吧&#xff0c;以后有空再更新&#xff0c;还要一些作业没写完.... 目录 概述查看grep命令的所有选项grep的常用选项选项-i选项-v选项-n选项-c​编辑选项-l组合使用 概述 grep命令在Linux系统中是一个很重要的文本搜索工具和过…...

spark6. 如何设置spark 日志

spark yarn日志全解 一.前言二.开启日志聚合是什么样的2.1 开启日志聚合MapReduce history server2.2 如何开启Spark history server 三.不开启日志聚合是什么样的四.正确使用log4j.properties 一.前言 本文只讲解再yarn 模式下的日志配置。 二.开启日志聚合是什么样的 在ya…...

glibc: strlcpy

https://zine.dev/2023/07/strlcpy-and-strlcat-added-to-glibc/ https://sourceware.org/git/?pglibc.git;acommit;h454a20c8756c9c1d55419153255fc7692b3d2199 https://linux.die.net/man/3/strlcpy https://lwn.net/Articles/612244/ 从这里看&#xff0c;这个strlcpy、st…...

如何在 Buildroot 中配置 Samba

在 Buildroot 中配置 Samba 在 Buildroot 中配置 Samba 可以通过以下步骤完成&#xff1a; 1. 进入 Buildroot 的根目录。 2. 执行 make menuconfig 命令&#xff0c;打开 Buildroot 的配置菜单。 3. 在配置菜单中&#xff0c;使用键盘导航到 "Target packages" 选…...

SSM02

SSM02 此时我们已经做好了登录模块接下来可以做一下学生管理系统的增删改查操作 首先&#xff0c;我们应当有一个登录成功后的主界面 在webapp下新建 1.main.html <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"&…...

day3_QT

day3_QT 1、文件保存2、始终事件 -闹钟 1、文件保存 2、始终事件 -闹钟 widget.h #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QTimerEvent> #include <QTime> #include <QTextToSpeech>QT_BEGIN_NAMESPACE namespace Ui { clas…...

js-map方法中调用服务器接口

在 Array.prototype.map() 方法中调用服务器接口时&#xff0c;可以使用异步函数来处理。 示例&#xff1a; async function fetchData() {try {const response await fetch(https://api.example.com/data); // 通过 fetch 发送请求const data await response.json(); // 解…...

docker 已经配置了国内镜像源,但是拉取镜像速度还是很慢(gcr.io、quay.io、ghcr.io)

前言 国内用户在使用 docker 时&#xff0c;想必都遇到过镜像拉取慢的问题&#xff0c;那是因为 docker 默认指向的镜像下载地址是 https://hub.docker.com&#xff0c;服务器在国外。 网上有关配置 docker 国内镜像源的教程很多&#xff0c;像 腾讯、阿里、网易 等等都会提供…...

[linux(静态文件服务)] 部署vue发布后的dist网页到nginx

所以说&#xff1a; 1.windows下把开发好的vue工程打包为dist文件然后配置下nginx目录即可。 2.linux上不需要安装node.js环境。 3.这样子默认访问服务器ip地址&#xff0c;就可以打开&#xff0c;毕竟默认就是&#xff1a;80端口。...

智华计算机终端保护检查系统使用笔记

使用说明 【智华保密检查右键管理员运行后粘贴密码】—— 点击脚本更改系统时间【智华计算机终端保护检查系统】—— 打开检测软件进行保密检查 检测文件格式 .pdf .doc .docx .xls .pptx 检测时间日志 2023年9月14日A&#xff1a;【34:03秒】2023年9月14日B&#xff1a;【…...

前端面试话术集锦第 15 篇:高频考点(React常考进阶知识点)

这是记录前端面试的话术集锦第十五篇博文——高频考点(React常考进阶知识点),我会不断更新该博文。❗❗❗ 1. HOC 是什么?相比 mixins 有什么优点? 很多人看到高阶组件(HOC)这个概念就被吓到了,认为这东西很难,其实这东西概念真的很简单,我们先来看一个例子: func…...

汽车电子——产品标准规范汇总和梳理(适应可靠性)

文章目录 前言 一、电气性能要求 二、机械性能要求 三、气候性能要求 四、材料性能要求 五、耐久性能要求 六、防护性能要求 总结 前言 见《汽车电子——产品标准规范汇总和梳理》 一、电气性能要求 《GB/T 28046.2-2019&#xff08;ISO 16750-2&#xff1a;2012&#…...

计算机是如何工作的(上篇)

计算机发展史 世界上很多的高科技发明,来自于军事领域 计算机最初是用来计算弹道导弹轨迹的 弹道导弹 ~~国之重器,非常重要 两弹一星 原子弹,氢弹,卫星(背后的火箭发射技术) 计算弹道导弹轨迹的计算过程非常复杂,计算量也很大 ~~ 但是可以手动计算出来的(当年我国研究两弹一…...

数学建模| 优化入门+多目标规划

优化入门多目标规划 优化入门知识什么是优化问题如何判断是不是优化问题优化模型建模求解器优化问题的分类 多目标规划 优化入门知识 什么是优化问题 优化问题&#xff1a;求最优&#xff0c;例如获利最大、最少损失、最短路径、最小化风险等等。 例如&#xff1a;之前文章提…...

SSM整合Thymeleaf时,抽取公共页面并向其传递参数

第一步 创建一个名为 header.html 的公共头部页面模板&#xff0c;放在 WEB-INF 目录下的 common 文件夹中。在 header.html 中可以编写头部页面的HTML代码&#xff0c;并通过Thymeleaf的语法来接收参数&#xff0c;如下所示&#xff1a; <!DOCTYPE html> <html xml…...

接口测试 —— requests 的基本了解

● requests介绍及安装 ● requests原理及源码介绍 ● 使用requests发送请求 ● 使用requests处理响应 ● get请求参数 ● 发送post请求参数 ● 请求header设置 ● cookie的处理 ● https证书的处理 ● 文件上传、下载 requests介绍 ● requests是python第三方的HTT…...

2023年华为杯数学建模研赛D题思路解析+代码+论文

下文包含&#xff1a;2023华为杯研究生数学建模竞赛&#xff08;研赛&#xff09;D题思路解析代码参考论文等及如何准备数学建模竞赛&#xff08;22号比赛开始后逐步更新&#xff09; C君将会第一时间发布选题建议、所有题目的思路解析、相关代码、参考文献、参考论文等多项资…...

建设企业网站的具体步骤/地推拉新app推广接单平台

题目&#xff1a;原题链接&#xff08;中等&#xff09; 标签&#xff1a;哈希表、数组、双指针 解法时间复杂度空间复杂度执行用时Ans 1 (Python)实例化 : O(N)O(N)O(N) ; 计算 O(C1C2)O(C1C2)O(C1C2)&#xff08;其中C为向量中值的数&#xff09;O(C)O(C)O(C)1948ms (66.1…...

网站备案工信部/app投放推广

新西兰程序员 ASP.NET网站中设置404自定义错误页面 在用ASP.NET WebForm开发一个网站时&#xff0c;需要自定义404错误页面. 做法是这样的 在网站根目录下建立了一个404.html的错误页面&#xff0c;然后在Global.asax文件中&#xff0c;加入如下代码&#xff1a; <% Applica…...

做网站 接单/全网营销的公司

安装8723bs.ko模块之后&#xff0c;生成了wlan0和wlan1&#xff0c;MAC地址一样。 http://blog.csdn.net/djman007/article/details/46731335 解决方法&#xff1a; insmod rtl8723.ko ifnamewlan0 if2namep2p0 wlan0和p2p0共用一个网卡。MAC地址也比较类似。 Tony Liu 2016-12…...

ps海报素材网/seo网站优化知识

写一个脚本/root/bin/yesorno.sh&#xff0c;提示用户输入yes或no,并判断用户输入的是yes还是no,或是其它信息#!/bin/bash read -p"put your answer(yes or no):" Answer case $Answer in y|Y|[yY][eE][sS]) //判断用户输入yes时的一切可能性echo &q…...

做国内打不开的网站/公众号推广

隐语义模型&#xff08;LFM&#xff09; 通过隐含特征(latent factor)联系用户兴趣和物品。比如给用户推荐图书的场景&#xff0c;隐含特征可以是图书的类别。通过降维的方法补全评分矩阵。 算法理论 用户uuu对物品iii的兴趣 r^uipuTqi∑k1Kpu,kqi,k\hat{r}_{ui}p^T_u q_i\s…...

wordpress 变更域名/nba总得分排行榜最新

spring-boot-starter-parent 可以继承spring-boot-starter-parent项目来获取合适的默认设置。 想配置你的项目继承spring-boot-starter-parent只需要简单地设置parent为&#xff1a; <parent><groupId>org.springframework.boot</groupId><artifactId>…...