分页: 4/240 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]
曾经几次发生404的问题导致服务器请求很慢,这个问题一直都还没有明确原因。
为什么404错误会导致连接数特别高?

引用
Active connections: 1118
server accepts handled requests
48870809 48870809 48557219
Reading: 1116 Writing: 2 Waiting: 0

Active connections: 17
server accepts handled requests
50852281 50852281 50537511
Reading: 16 Writing: 1 Waiting: 0


上面是nginx在404错误时,和修复404错误之后的变化,404错误居然能够产生有1k多的连接。
更换为lighttpd也是一样,顶不住。。
reading的数量特别高,导致访问其它服务特别慢。汗一把。。有空再细看资料,大家平时多注意。。。
Tags:
这样的文章挺多的,出处太多了,就不列举了。

收录在此备忘。
我自己电脑就是这样设置的,明显觉得眼睛没有那么疲惫,但也有缺点,部分网页没有明确标明背景颜色,则会显示浅绿色的背景。

引用
现代人几乎每天都离不开电脑。在工作、娱乐、交友,甚至买卖股票的过程中,电脑都是我们的好帮手。但是,许多应用软件的背景,尤其是网页的底色通常被设定为刺眼的白色,看得久了,眼睛就会出现疲劳、酸涩,甚至流泪的现象。
  卫生部近视眼重点实验室主任、复旦大学医学院眼科教授褚仁远说,绿色和蓝色对眼睛最好,建议大家在长时间用电脑后,经常看看蓝天、绿地,就能在一定程度上缓解视疲劳。同样的道理,如果我们把电脑屏幕和网页的底色变为淡淡的苹果绿,也可在一定程度上有效地缓眼睛疲劳等症状了。

下面就教你如何把网页底色变成淡淡的苹果绿:

  第一步, 在桌面上点击鼠标右键,依次点击“属性”、“外观”、“高级”按钮。

  第二步, 在打开的“高级”对话框中,在“项目”下拉列表里选择“窗口”。

  第三步, 再打开右边对应的“颜色”列表,选择其中的“其他”一项,在打开的对话框里,把“色调”的参数设置为85,把“饱和度”参数设置为90,把“亮度”参数设置为205。再点击“确定”退出设置。

  第四步,打开ie浏览器,选择“工具”栏中的“internet选项”,点击“辅助功能”按钮,在“不使用网页中指定的颜色”前打钩。

  全部步骤完成后,网页、文件夹、文本文档里的背景颜色都变成了绿色。其中,色调、饱和度和亮度的参数值,还可以根据个人的喜好稍作修改,让自己用电脑的候最舒服。

keepalived可以保证虚拟IP的稳定性,虽然在使用,但没有很详细的了解,试图通过测试能够避免一些未知问题。现在发现的问题是IP接管被奇怪的转移,还有待考察。。。

硬件环境:

两个机器 192.168.1.44(MASTER) 192.168.1.38(BACKUP)
虚拟IP 192.168.1.69

配置(44):

[root@localhost ~]# cat /etc/keepalived/keepalived.conf
#! Configuratio File for keepalived
vrrp_script chk_nginx_port {
        script "</dev/tcp/127.0.0.1/80" # connects and exits
        interval 1                      # check every second
        weight -20                      # default prio: -20 if connect fails
}
global_defs {
        notification_email {
                root
        }
        notification_email_from root
        smtp_server localhost
        smtp_connect_timeout 30
        router_id local128
}
vrrp_instance VI_m1 {
        state MASTER #主服务器配置
        interface eth0  #网卡0
        virtual_router_id 110 #router_id 一定要一致
        priority 110 #主从征用的权重 主服务器一定要大于从服务器
        advert_int 1 #一秒检查一次
        authentication { #认证的密码
                auth_type PASS
                auth_pass WeMoshLzy
        }  
        virtual_ipaddress {
                192.168.1.69 label eth0:1 #要切换的ip
        }  
        track_script {
                chk_nginx_port # 检查的脚本
        }  
}


38的配置:
修改 state MASTER 为 state BACKUP
priority 改为 100

web服务器(首页内容要不同)启动后,启动keepalived,开始测试。

查看IP的方式:

[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:5d:e9:7b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.44/24 brd 192.168.1.255 scope global eth0
    [color=#FF0000]inet 192.168.1.69/32 scope global eth0:1[/color]
    inet6 fe80::20c:29ff:fe5d:e97b/64 scope link
       valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0


也就是现在69的ip是在44的机器上监听着:

[root@aslibra ~]# curl http://192.168.1.69/
44

我们做个脚本,看看切换过程都有哪些问题:
Tags: , ,
今天的发现,有预置的key->value的系统存储接口:

引用
使用 SharedPreferences

SharedPreferences 使用 xml 格式为 Android 应用提供一种永久的数据存贮方式。对于一个 Android 应用,它存贮在文件系统的 /data/ data/your_app_package_name/shared_prefs/目录下,可以被处在同一个应用中的所有 Activity 访问。Android 提供了相关的 API 来处理这些数据而不需要程序员直接操作这些文件或者考虑数据同步问题。


// 写入 SharedPreferences
SharedPreferences preferences = getSharedPreferences("name", MODE_PRIVATE);
Editor editor = preferences.edit();
editor.putBoolean("boolean_key", true);
editor.putString("string_key", "string_value");
editor.commit();
        
// 读取 SharedPreferences
SharedPreferences preferences = getSharedPreferences("name", MODE_PRIVATE);
preferences.getBoolean("boolean_key", false);
preferences.getString("string_key", "default_value");


另外,文章介绍的 Activity 的 Intent Filter 部分也是不错的,详细的得看原文。
Tags:
这篇文章差不多是十年前写的,但也还是可以读一读的。

1 硬盘分区的讲究,其实之前没有这么想

引用
2.1 优化的分区

在安装Linux系统之初,就应该考虑怎样使linux系统得到最好的性能。在Linux系统中,我们可以自由地组织磁盘分区。一个优化的分区策略,可以很好地改进Linux系统的性能,减少磁盘碎片,提高磁盘I/O能力。

根据磁盘的特点,我们知道越是靠磁盘外部的柱面,旋转越快,而且每次旋转时,磁盘读写头可以覆盖较多的区域,也就意味着靠外部的柱面可以得到较好的性能。所以在分区时,我们应该考虑将访问频率高的,对系统性能影响相对较大的分区置于磁盘的靠外部分。同时,为了减少磁盘碎片,应将内容经常改变的目录放在单独的分区。从方便备份数据的角度考虑,因为很多备份工具对整个分区进行备份的效率要高,所以我们应将Linux系统的几个主要的目录作为单独的文件系统,为它们各自分配一个区。推荐的分区策略如图一:

点击在新窗口中浏览此图片
Tags: ,
没有时间细看那么多文章,在此摘录和备忘一些内容:
(有些都是人家三年前的研究了。。落伍啊,部分可能正常方式访问不到,再次和国外落伍了。。)

1 The Android boot process from power on

引用
1. Power on and boot ROM code execution
2. The boot loader
3. The Linux kernel
4. The init process
5. Zygote and Dalvik
6. The system server
7. Boot completed


2 Android Initialization Process

引用
init is the first process after kernel started. The corresponding source code lies in: device/system/init. It does the following tasks step by step:

1.       Initialize log system.

2.       Parse /init.rc and /init.%hardware%.rc.

3.       Execute early-init action in the two files parsed in step 2.

4.       Device specific initialize. For example, make all device node in /dev and download firmwares.

5.       Initialize property system. Actually the property system is working as a share memory. Logically it looks like a registry under Windows system.

6.       Execute init action in the two files parsed in step 2.

7.       Start property service.

8.       Execute early-boot and boot actions in the two files parsed in step 2.

9.       Execute property action in the two files parsed in step 2.

10.   Enter into an indefinite loop to wait for device/property set/child process exit events. For example, if an SD card is plugined, init will receive a device add event, so it can make node for the device. Most of the important process is forked in init, so if any of them crashed, init will receive a SIGCHLD then translate it into a child process exit event, so in the loop init can handle the process exit event and execute the commands defined in *.rc(it will run command onrestart).
Tags:
分页: 4/240 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐