这个月月末准备办一个免费的Solr交流会,有兴趣的同学可以加入到QQ群:181963043报名参加。主要内容: 

 

1:Solr的基本架构和应用

2:Solr分布式

3:Solr性能优化

4:基于Solr的全文检索架构

5:Solr开发

6:EasyNet.Solr的应用

 

地点可能在北京东四十条附近。

 

posted @ 2012-05-11 09:37 TerryLiang 阅读(12) 评论(0) 编辑

/etc/sysctl.conf内核配置文件优化:

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

# User Define
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608

关闭selinux,修改/etc/selinux/config:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

系统最大打开文件数,修改/etc/security/limits.conf:

# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
* soft nofile 65535
* hard nofile 65535
# End of file

 

posted @ 2012-05-09 11:08 TerryLiang 阅读(49) 评论(0) 编辑

在上周晚上冒着大雨参加了IT龙门阵主办的,由口袋购物候迅发表的主题为“智能推荐在移动电子商务中的应用”的主题演讲。在演讲中,候迅提出了一种”发现式无意识购物“的观点。很多人在很多时候,去商场,或者去压马路,可能并不是专门买什么而去的,或者是为了专门买什么而去,但是在逛的过程中,发现了一些促销信息、一些吸引眼球的广告、一些好玩感兴趣的东西等等,在很大可能上会产生购买行为。

由于手机的移动性,随处可用,无处不在,我觉得在移动互联网上实现”发现式无意识购物“更具有意义。用户购物,用户在手机上逛街,这些都是用户行为,但是怎么提供给用户虚拟的购物环境,也就是这个”街“,让用户在无目的行为中,产生兴趣,促使消费,这就是移动互联网应用开发商应该考虑的问题。

现实生活中,我的购物环境,也就是这个街,正常情况是个死的。你今天去,还是明天去,店铺商品一般变化不大。但是在移动互联网的虚拟环境下,就不会存在这种情况。他没有时间性,没有区域性。在现实中逛街,当你在店铺里面发现了一件自己感兴趣的商品,那么店员就会给你讲解沟通。在网络上,当然不会存在类似的角色,但是,我觉得,智能推荐提供了类似的功能。

智能推荐、推荐引擎、个性化智能推荐,这些都是在电子商务领域不可缺少的功能和研究课题。通过对用户行为的分析,用户分类聚合,推荐用户可能感兴趣的商品,这就是商品推荐引擎的目录。

个性化智能推荐,我觉得也可以称之为基于上下文的推荐。用户个性化推荐区别于普适推荐,用户在使用应用时,有一些当时的使用场景,即上下文信息,比如时间、所处地理位置、活动状态、网络状态等等。

基于上下文的个性化智能推荐,这是一个目前在学术界研究的一个难点课题,据我所知目前还没有完善的模型。在实际应用中,我觉得可以这么处理,一种方法是 利用上下文信息在数据处理前进行过滤,另一种方式是在数据处理后,利用上下文信息对结果进行过滤,第三种方法就是在运行时,根据上下文信息参与数据运算。我觉得前两种方法应该更容易些。

无论是传统的普适推荐,还是个性化推荐,还是基于上下文的个性化推荐,都离不开基本数学理论,但是针对实际应用场景,采用适合自己的算法,模型,还是需要在实践应用中进行逐步调整。

posted @ 2012-04-27 11:48 TerryLiang 阅读(1486) 评论(0) 编辑

在硬件系统上安装Linux系统之前,需要考虑许多有助于优化操作系统以及日后在其运行的应用程序的性能问题。这些问题包括:

  • 选择分区位置
  • 使用多个硬盘驱动器
  • 选择文件系统

Linux至少需要一个root分区和一个swap分区,这两个分区以及其他需要频繁访问的分区在磁盘上的安装位置最终会影响到系统的性能。

  • 对于var、swap、/var、/usr和/home等分区,都分别使用单独的分区
  • 大多数硬盘驱动器的盘片在外侧磁道上封装的扇区要多于内侧磁道,因此从外侧磁道上读取数据要快得多。通常将编号较低的分区安装到外部磁道上(例如,/dev/hda1比/dev/hda3更接近与硬盘驱动器的外侧边缘),因此首先要放置需要经常访问的分区
  • 第一个分区应该是swap分区(用于优化内存交换操作)
  • 第二个分区应该是/var,因为日志记录会频繁地写入/var/log中
  • 下一个分区应该是/usr,因为基本的系统工具和命令都位于/usr中
  • root和/home分区可以驻留在靠近硬盘驱动器末尾的位置

使用多个硬盘驱动器,并要充分利用多个硬盘驱动器。

  • 将经常访问的分区安装到更快的硬盘驱动器上
  • 如果这些硬盘驱动器的性能相近,那么将常用的分区分别安装在不同的硬盘驱动器上。例如,讲/var和/usr分区分别置于两个不同的硬盘驱动器上,而交换分区位于自己单独的硬盘驱动器上
  • 为了最大话总线吞吐率,应该将每个充当主设备的硬盘驱动器安放到I/O通道上。硬盘驱动器在不同I/O通道之间移动后,其设备名称会发生变化,因此需要对文件系统表(/etc/fstab)进行相应改动。如果对包含root或/boot分区的硬盘驱动器进行移动,那么还需要编辑/boot/grub/menu.lst文件

文件系统类型

  • ext4,ext3的改进版,提供更加的性能和可靠性,更为丰富的功能
  • ReiserFS,对于小型文件具有更佳的性能
  • XFS,针对大型文件具有更佳的性能
posted @ 2012-04-07 20:07 TerryLiang 阅读(30) 评论(0) 编辑

随着Solr的广泛的应用,Solr的版本更新也加快了脚本,EasyNet.Solr(http://easynet.codeplex.com/)其实一直在断断续续维护中,今天也发布了最新版本,完全支持Solr 3.5.1。相对于目前Solr基于.Net的客户端SolrSharp(http://solrsharp.codeplex.com/)、Solr.Net(http://code.google.com/p/solrnet/),具有以下特点:

 

1.完全支持Solr官方的Xml、Json,特别是Javabin协议

2.基于接口的序列化策略,提供更好的性能

3.简单接口,具有很高的扩展性

 

EasyNet.Solr使用原则和建议:

 

1.建议Solr部署在Linux下,并对Tomcat、JVM、系统内核进行优化

2.一定要使用Replication

3.建议采用Javabin协议,在solrconfig中直接设置默认输出协议为Javabin:<queryResponseWriter name="javabin"  default="true" class="solr.BinaryResponseWriter"/> 

4.轻易不要对Solr进行改动,尽量在上层实现

5.优化可以参考 http://wiki.apache.org/lucene-java/BasicsOfPerformance,http://wiki.apache.org/solr/SolrPerformanceFactors

 

EasyNet.Solr的应用示例请参加:http://easynet.codeplex.com/wikipage?title=EasyNet%20Solr。

 

Blog:http://www.cnblogs.com/terryliang
QQ:124244236
Email:easynet.cn@gmail.com liangtianyu@gmail.com

EasyNet QQ Group: 181963043 

 

posted @ 2012-02-05 20:51 TerryLiang 阅读(1113) 评论(1) 编辑
摘要: 静态化处理,可以大大提高客户的访问浏览速度,提高用户体验,同时也降低了服务器本身的压力。在asp.net mvc3中,可以相对容易地处理静态化问题,不用过多考虑静态网页的同步,生成等等问题。我提供这个方法很简单,就需要在需要静态化处理的Controller或Action上加一个Attribute就可以。下面是我写的一个生成静态文件的ActionFilterAttribute。1usingSystem;2usingSystem.IO;3usingSystem.Text;4usingSystem.Web;5usingSystem.Web.Mvc;6usingNLog;78///<summar阅读全文
posted @ 2011-11-13 13:08 TerryLiang 阅读(2463) 评论(17) 编辑
摘要: 禁用网络管理器# chkconfigNetworkManageroff# service NetworkManager stop创建用以桥接的虚拟网卡# cd/etc/sysconfig/network-scripts# cpifcfg-eth0ifcfg-br0编辑ifcfg-br0# viifcfg-br0DEVICE="br0"TYPE="Bridge"ONBOOT="yes"BOOTPROTO=staticIPADDR=192.168.1.17PREFIX=24GATEWAY=192.168.1.1DNS1=202.106.4阅读全文
posted @ 2011-09-23 15:08 TerryLiang 阅读(412) 评论(0) 编辑
摘要: 我的CentOS 6采用的最小安装,ipvsadm和keepalived均采用最新版本。# yum update libnl-devel # cd /home/software/lvs # tar zxvf popt-1.14.tar.gz # cd popt-1.14 # ./configure # make # make install # ln -s /usr/src/kernels/2.6.32-71.29.1.el6.x86_64/ /usr/src/linux # tar zxvf ipvsadm-1.26.tar.gz # cd ipvsadm-1.26 # make # mak阅读全文
posted @ 2011-09-22 11:40 TerryLiang 阅读(289) 评论(0) 编辑
摘要: Percona Server(http://www.percona.com/)是MySQL的衍生版,其对MySQL进行了改进,在功能、性能和稳定性上有着显著的提高。下面介绍一下如何用源码自行编译安装目前最新版本的Percona Server 5.5。服务器系统版本为Centos 6。从地址http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.15-21.0/source/Percona-Server-5.5.15-rel21.0.tar.gz下载最新源码包,并拷贝到/home/software/阅读全文
posted @ 2011-09-20 13:01 TerryLiang 阅读(1367) 评论(0) 编辑
摘要: 从http://activemq.apache.org/download.html下载ActiveMQ的最新版本,当前是5.50,把包apache-activemq-5.5.0-bin .tar.gz拷贝到/home/software/apache-activemq目录下,执行以下命令:# cd/home/software/apache-activemq# tar zxvf apache-activemq-5.5.0-bin .tar.gz# cp -a apache-activemq-5.5.0 /usr/local/activemq# cd /usr/local/activemq我使用my阅读全文
posted @ 2011-09-16 11:27 TerryLiang 阅读(301) 评论(0) 编辑