Buckets

Hive clustered by on more than one column

怎甘沉沦 提交于 2019-11-29 19:05:37
问题 I understand that when the hive table has clustered by on one column, then it performs a hash function of that bucketed column and then puts that row of data into one of the buckets. And there is a file for each bucket i.e. if there are 32 buckets then there are 32 files in hdfs. What does it mean to have the clustered by on more than one column? For example, lets say that the table has CLUSTERED BY (continent, country) INTO 32 BUCKETS. How would the hash function be performed if there are

查看网络丢包的命令

前提是你 提交于 2019-11-29 08:07:40
查看网络丢包 $ sudo tcpdump -i eth0 port 22 and "tcp[tcpflags] & (tcp-syn) != 0" 网络丢包的原因 防火墙拦截 查看iptables filter表,确认是否有相应规则会导致此丢包行为: $ sudo iptables-save -t filter 连接跟踪表溢出 通过dmesg可以确认是否有该情况发生: $ dmesg |grep nf_conntrack 如果输出值中有“nf_conntrack: table full, dropping packet”,说 明服务器nf_conntrack表已经被打满。 通过/proc文件系统查看nf_conntrack表实时状态: # 查看nf_conntrack表最大连接数 $ cat /proc/sys/net/netfilter/nf_conntrack_max 65536 # 查看nf_conntrack表当前连接数 $ cat /proc/sys/net/netfilter/nf_conntrack_count 7611 如何解决 如果确认服务器因连接跟踪表溢出而开始丢包,首先需要查看具体连接判断是否正遭受DOS攻击,如果是正常的业务流量造成,可以考虑调整nf_conntrack的参数: nf_conntrack_max决定连接跟踪表的大小,默认值是65535

JavaScript 数据结构与算法之美 - 桶排序、计数排序、基数排序

故事扮演 提交于 2019-11-29 06:03:14
1. 前言 算法为王。 想学好前端,先练好内功,只有内功深厚者,前端之路才会走得更远 。 笔者写的 JavaScript 数据结构与算法之美 系列用的语言是 JavaScript ,旨在入门数据结构与算法和方便以后复习。 之所以把 计数排序、桶排序、基数排序 放在一起比较,是因为它们的平均时间复杂度都为 O(n) 。 因为这三个排序算法的时间复杂度是线性的,所以我们把这类排序算法叫作 线性排序 (Linear sort)。 之所以能做到线性的时间复杂度,主要原因是,这三个算法不是基于比较的排序算法,都不涉及元素之间的比较操作。 另外,请大家带着问题来阅读下文,问题:如何根据年龄给 100 万用户排序 ? 2. 桶排序(Bucket Sort) 桶排序是计数排序的升级版,也采用了 分治思想 。 思想 将要排序的数据分到有限数量的几个有序的桶里。 每个桶里的数据再单独进行排序(一般用插入排序或者快速排序)。 桶内排完序之后,再把每个桶里的数据按照顺序依次取出,组成的序列就是有序的了。 比如: 桶排序利用了函数的映射关系,高效与否的关键就在于这个映射函数的确定。 为了使桶排序更加高效,我们需要做到这两点: 在额外空间充足的情况下,尽量增大桶的数量。 使用的映射函数能够将输入的 N 个数据均匀的分配到 K 个桶中。 桶排序的核心:就在于怎么把元素平均分配到每个桶里

使用Prometheus监控的Spring Boot程序

青春壹個敷衍的年華 提交于 2019-11-27 16:01:47
本文将会带领读者,在Spring Boot/Spring Cloud应用中添加对Prometheus监控的支持,以实现对应用性能以及业务相关监控指标的数据采集。同时也会介绍Prometheus中不同的Metrics类型的使用场景。 添加Prometheus Java Client依赖 这里使用0.0.24的版本,在之前的版本中Spring Boot暴露的监控地址,无法正确的处理Prometheus Server的请求,详情: https://github.com/prometheus/client_java/issues/265 # build.gradle ... dependencies { ... compile 'io.prometheus:simpleclient:0.0.24' compile "io.prometheus:simpleclient_spring_boot:0.0.24" compile "io.prometheus:simpleclient_hotspot:0.0.24" } ... 启用Prometheus Metrics Endpoint 添加注解@EnablePrometheusEndpoint启用Prometheus Endpoint,这里同时使用了simpleclient

apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104))

旧城冷巷雨未停 提交于 2019-11-27 05:14:04
apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) 今天用apache 自带的ab工具测试,当并发量达到1000多的时候报错如下: [root@aa~]# This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.1.176 (be patient) Completed 300 requests Completed 600 requests Completed 900 requests apr_socket_recv: Connection reset by peer (104) Total of 1085 requests completed 查看应用服务器和数据库均未报错,连接被重置,bingyi了以下

sysctl

巧了我就是萌 提交于 2019-11-25 20:50:09
sysctl.sh #!/bin/bash sysctl -w net.unix.max_dgram_qlen=100 sysctl -w net.ipv4.conf.default.rp_filter=1 sysctl -w net.ipv4.conf.default.accept_source_route=0 sysctl -w net.ipv4.tcp_syncookies=1 sysctl -w net.ipv4.tcp_max_tw_buckets=360000 sysctl -w net.ipv4.tcp_sack=1 sysctl -w net.ipv4.tcp_window_scaling=1 sysctl -w 'net.ipv4.tcp_rmem=4096 87380 4194304' sysctl -w 'net.ipv4.tcp_wmem=4096 16384 4194304' sysctl -w net.core.wmem_default=8388608 sysctl -w net.core.rmem_default=8388608 sysctl -w net.core.rmem_max=16777216 sysctl -w net.core.wmem_max=16777216 sysctl -w net.core.netdev_max_backlog