增加应用的CPU时间片利用率
增加应用内存利用率
减少非应用的CPU占用
工具使用:
Linux的iostat,vmstat
Java本身提供的工具:
jstack,jstat,jps,jdb
增加应用的CPU时间片利用率
增加应用内存利用率
减少非应用的CPU占用
工具使用:
Linux的iostat,vmstat
Java本身提供的工具:
jstack,jstat,jps,jdb
package com.liangyumingblog;
public class LinkList
{
private class Node
{
int value;
Node next;
public Node(int value, Node next)
{
this.value = value;
this.next = next;
}
}
private Node head = new Node(-1, null);
private int size = 0;
public void add(int value)
{
size++;
Node current = head;
while (current.next != null)
{
current = current.next;
}
current.next = new Node(value, null);
}
public Node getLast()
{
Node current = head;
while (current.next != null)
{
current = current.next;
}
return current;
}
public Node removeLast()
{
Node current = head;
while (current.next.next != null)
{
current = current.next;
}
Node tmp = current.next;
current.next = null;
tmp.next = null;
return tmp;
}
public void reverse()
{
int length = 0;
while (length != size)
{
insert(length, removeLast());
length++;
}
}
public boolean insert(int index, Node node)
{
if (index > size)
{
return false;
}
int now = 0;
Node current = head;
while (now != index)
{
++now;
current = current.next;
}
Node tmp = current.next;
current.next = node;
node.next = tmp;
return true;
}
@Override
public String toString()
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("[");
Node current = head;
while (current.next != null)
{
if (head != current)
{
stringBuffer.append(current.value);
stringBuffer.append(", ");
}
current = current.next;
}
stringBuffer.append(current.value);
stringBuffer.append("]");
return stringBuffer.toString();
}
}
结果是觉得有点太大,在车上看简直扑街。。。
为了搞个下载机,买了个树莓派,结果还是坏的。。扑街。。
为了打游戏上了个电信,结果上传只有2mkbps,扑街。。。
总结是冲动消费不可取。。。。
(totalrow+singlePageSize-1 )/singlePageSize
为什么说是个小trick呢
直观上我们做分页算法应该是这样的
return totalSize%singlePageSize!=0?totalSize/singlePageSize+1:totalSize/singlePageSize;
但是呢,最开始提到的算法,如果total/single有余数,由于int的直接截取的性质,所以totalrow/singlePageSize是向下取整了,但是这个余数加上(singlePageSize-1)再去除singlePagesize就刚好能够+1
否则因为(singePageSize-1)/SinglePageSize向下取整的性质,就变成了+0。所以说这里这个小Trick我还真没想到过,很巧妙
中央认证服务器:用于生成ticket
应用服务器:要约定一个页面用于接收ticket,并写入相同域名内的cookie
生成ticket的机制
ticket的失效机制
每次验证ticket都需要到中央服务器认证:增加内部流量
通过租约:会有失效时间,不能保证马上所有位置都失效
中央服务器push到业务端通知失效:中央服务器压力大
室友自杀,送医院,然后我被吓尿了。。。T_T。。。
真的要好好重视精神卫生健康啊
package main
import "fmt"
func main() {
var nums = [] int{5, 4, 3, 2, 1, 4, 5, 3}
sort(nums, len(nums))
fmt.Println(nums)
}
func sort(nums []int, length int) {
for i := 0; i < length; i++ {
for j := 0; j < length; j++ {
if (nums[i] > nums[j]) {
swap(&nums[i], &nums[j])
}
}
}
}
func swap(a *int, b *int) {
*a, *b = *b, *a
}

分别从用途,风险和好处来思考了下,只是很粗浅的思考,刚好我所在的项目就是做账号平台,才用来思考
就是简单的输出一些字符串,用以学习Go的package和实际的path的关系
package main
import (
"fmt"
"HelloWorld/heelo"
)
func main() {
p()
}
func p() {
fmt.Println("Hello", "HelloTat")
heelo.Hehe()
}
package heelo
import "fmt"
func Hehe() {
fmt.Println("this is Hello2")
}