#
Packt Publishing celebrates their 2000th title with an exclusive offer - We've got IT covered!
Known for their
extensive range of pragmatic IT ebooks, Packt
Publishing are celebrating their 2000th book title `Learning Dart’– they want
their customers to celebrate too.
To mark this
milestone Packt Publishing will launch a ‘Buy One Get One Free’ offer across
all eBooks on March 18th – for a limited period only.
Packt is one of
the most prolific and fast-growing tech book publishers in the world.
Originally focused on open source software, Packt contributes back into the
community paying a royalty on relevant books directly to open source projects.
These projects have received over $400,000 as part of Packt’s Open Source
Royalty Scheme to date.
Their books focus
on practicality, recognising that readers are ultimately concerned with getting
the job done. Packt’s digitally-focused business model allows them to quickly
publish up-to-date books in very specific areas across a range of key
categories – web development, game development, big data, application
development, and more. Their commitment to providing a comprehensive range of
titles has seen Packt publish 1054% more titles in 2013 than in 2006.
Here are some of
the best titles across Packt's main categories - but Buy One, Get One Free will
apply across all 2000 titles:
·
Web
Development
·
Big
Data & Cloud
·
Game
Development
·
App
Development
通常數(shù)據(jù)庫(kù)是安裝在一臺(tái)服務(wù)器上,如果服務(wù)器DOWN機(jī),則數(shù)據(jù)服務(wù)停止。這樣在生產(chǎn)環(huán)境是不合適的,必須部署兩臺(tái)以上的服務(wù)器且都安裝有相同數(shù)據(jù)的數(shù)據(jù)庫(kù)。這樣就產(chǎn)生了一個(gè)問(wèn)題,同一份數(shù)據(jù)在不同的機(jī)子上,會(huì)導(dǎo)致數(shù)據(jù)不同步的問(wèn)題。一般的方案是:
服務(wù)端:
互責(zé)數(shù)據(jù)同步,一臺(tái)服務(wù)器專門(mén)做寫(xiě)操作,其他服務(wù)器只做讀操作,即主從模式。當(dāng)主服務(wù)器DOWN機(jī)時(shí),會(huì)在從服務(wù)器中選出一臺(tái)做主服務(wù)器。在MONGODB中叫REPLICATION。
客戶端:
要判斷當(dāng)前與數(shù)據(jù)庫(kù)的鏈接,如果是讀操作,則使用與從服務(wù)器的鏈接,如果是寫(xiě)操作,則使用與主服務(wù)器的鏈接。這樣的判斷一般是由驅(qū)動(dòng)程序去做,配置的時(shí)候如果是MYSQL,就要使用REPLYCATION的驅(qū)動(dòng)。
如果數(shù)據(jù)庫(kù)里的某張表數(shù)據(jù)太多,會(huì)導(dǎo)致簡(jiǎn)單的查詢會(huì)需時(shí)過(guò)長(zhǎng)的問(wèn)題。一般的方案是限制每張表中不能放太多的數(shù)據(jù),如第一個(gè)月的數(shù)據(jù)放一張表,下一個(gè)月的數(shù)據(jù)放第二張表,這種做法稱為SHARDING,分表。但這樣會(huì)導(dǎo)致查詢的復(fù)雜性,如數(shù)據(jù)在第二張表,則要具體指明表名,否則查不出數(shù)據(jù)。目前的數(shù)據(jù)庫(kù),可以事先指定分表的規(guī)則,這樣查詢的語(yǔ)句不需改變,數(shù)據(jù)庫(kù)端會(huì)自動(dòng)判斷數(shù)據(jù)在哪張表,然后路由到那張表,去查找數(shù)據(jù)然后返回給客戶端。ORACLE叫分區(qū)表,MONGODB叫AUTO SHARDING。
服務(wù)端:
需事先指定數(shù)據(jù)分表規(guī)則,這樣收到查詢語(yǔ)句時(shí)數(shù)據(jù)庫(kù)就知道數(shù)據(jù)在哪張表中。
客戶端:
查詢數(shù)據(jù)時(shí)無(wú)需再指定分區(qū)表名了
TOMCAT集群時(shí)的SESSION如果是采用集群中的機(jī)子互相拷貝的話,會(huì)帶來(lái)性能問(wèn)題,一般是保存到數(shù)據(jù)庫(kù)中。如果是高并發(fā)的系統(tǒng),一般是保存至MONGODB中。
現(xiàn)有一開(kāi)源的項(xiàng)目是做這個(gè)的:
https://github.com/simplicityitself/Mongo-Tomcat-Sessions
db:sessions, collection:sessions,相應(yīng)配置在conf目錄下context.xml中的如下:
<Valve className="com.dawsonsystems.session.MongoSessionTrackerValve" />
<Manager className="com.dawsonsystems.session.MongoManager" host="10.120.11.221,10.120.11.122,10.120.11.212" port="27017" database="sessions" maxInactiveInterval="60"/>
MEMCACHED版:
http://www.oschina.net/p/memcached-session-manager
摘要: 3.1需求模型簡(jiǎn)介IEEE的軟件工程標(biāo)準(zhǔn)術(shù)語(yǔ)表將“需求”定義為:用戶所需的解決某個(gè)問(wèn)題或達(dá)到某個(gè)目標(biāo)所要具備的條件或能力。系統(tǒng)或系統(tǒng)組件為符合合同、標(biāo)準(zhǔn)、規(guī)范或其它正式文檔而必須滿足的條件或必須具備的能力。上述第一項(xiàng)或第二項(xiàng)中定義的條件和能力的文檔表述。RUP將“需求”定義為:需求描述了系統(tǒng)必須滿足的情況或提供的能力,它就可以是直接來(lái)自客戶需要,也可...
閱讀全文
摘要: 一波在線http://www.sxpeot.tkhttp://fineflight.tkhttp://furtherserviceds.tkhttp://themostro.tkhttp://lyard.tkhttp://besureascend.tkhttp://denningsan.tkhttp://www.symantecsecured.tkhttp://wanthit.tkhttp://w...
閱讀全文
一般的WEB應(yīng)用如果是連ORACLE,要做連接池的話是在JAVA端用第三方的LIB,但對(duì)于MONGODB,官方已經(jīng)有現(xiàn)成的實(shí)現(xiàn),只需配置即可。
#控制系統(tǒng)在發(fā)生連接錯(cuò)誤時(shí)是否重試 ,默認(rèn)為false --boolean
mongo.options.autoConnectRetry=false
#每個(gè)主機(jī)允許的連接數(shù)(每個(gè)主機(jī)的連接池大小),當(dāng)連接池被用光時(shí),會(huì)被阻塞住 ,默認(rèn)為10 --int
mongo.options.connectionsPerHost=10
#multiplier for connectionsPerHost for # of threads that can block if connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be throw --int
mongo.options.threadsAllowedToBlockForConnectionMultiplier=5
#被阻塞線程從連接池獲取連接的最長(zhǎng)等待時(shí)間(ms) --int
mongo.options.maxWaitTime
#在建立(打開(kāi))套接字連接時(shí)的超時(shí)時(shí)間(ms),默認(rèn)為0(無(wú)限) --int
mongo.options.connectTimeout=0
#套接字超時(shí)時(shí)間;該值會(huì)被傳遞給Socket.setSoTimeout(int)。默認(rèn)為0(無(wú)限) --int
mongo.options.socketTimeout=0
#This controls whether or not to have socket keep alive turned on (SO_KEEPALIVE). defaults to false --boolean
mongo.options.socketKeepAlive=false
#Override the DBCallback factory. Default is for the standard Mongo Java driver configuration --DBCallbackFactory
mongo.options.dbCallbackFactory
#//指明是否允許驅(qū)動(dòng)從次要節(jié)點(diǎn)或者奴隸節(jié)點(diǎn)讀取數(shù)據(jù),默認(rèn)為false --boolean
mongo.options.slaveOk=false
#如果為true,驅(qū)動(dòng)每次update后會(huì)發(fā)出一個(gè)getLastError命令來(lái)保證成功,默認(rèn)為false --boolean
mongo.options.safe=false
#If set, the w value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.w=0
#If set, the wtimeout value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.wtimeout=0
#Sets the fsync value of WriteConcern for the connection. Defaults to false; implies safe = true --boolean
mongo.options.fsync=false
摘要: 一.前言
很多同學(xué)問(wèn)我學(xué)習(xí)日語(yǔ)的方法,那么我現(xiàn)在就歸類整理,并介紹一下我總結(jié)的學(xué)習(xí)日語(yǔ)的4步曲,并且本人自信,認(rèn)真按照4部曲學(xué)習(xí)的同學(xué)快則5月,慢則1年,都能夠從入門(mén)的菜鳥(niǎo)級(jí)別達(dá)到N1或者N2的水平。
同時(shí)我想勸大家放棄那些所謂的日語(yǔ)學(xué)習(xí)方法匯總,大部分的就是動(dòng)詞一堆,假名一堆的羅列,我覺(jué)得還不如不發(fā)這種帖子,因?yàn)檫@個(gè)帖子發(fā)了等于沒(méi)發(fā),第一我不會(huì)看完,第二看完也記不住,第三記住了也用不來(lái)。所以希望那些所謂的牛人匯總?cè)照Z(yǔ)學(xué)習(xí)貼的同志,在你們整理的時(shí)候還是想想大多數(shù)普通的學(xué)習(xí)者的心態(tài),將心比心沒(méi)有任何人會(huì)有心情看完你們整理完的一堆所謂類似或者全部詞類的帖子,這樣毫無(wú)意義,除了賺人氣就是賺人氣,對(duì)學(xué)習(xí)者沒(méi)有任何幫助
閱讀全文
1、福田教學(xué)點(diǎn):
地址:福田區(qū)深南中路3007號(hào)國(guó)際科技大廈22樓(即上海賓館天橋正對(duì)面)
乘地鐵羅寶線到華強(qiáng)路站C出口10米即到
公交線路:坐車到上海賓館下車即到或到華富路站向東南100米
咨詢電話:0755-83752826
2、羅湖教學(xué)點(diǎn):
上課地點(diǎn):羅湖區(qū)深南東路3020號(hào)百貨廣場(chǎng)大廈東座908室(即東門(mén)門(mén)診部站臺(tái)后檸檬街樓上)
乘地鐵羅寶線1號(hào)線到老街C出口即到或龍崗3號(hào)線到老街C出口即到(雙地鐵連體物業(yè))
公交線路:坐車到門(mén)診部下車即到或東門(mén)下車向西150米即到
咨詢電話:0755-22969720
3、南山教學(xué)點(diǎn):
上課地點(diǎn):南海大道2225號(hào)海王大廈B座22樓(即創(chuàng)業(yè)天橋旁邊)
乘地鐵羅寶線到桃園站轉(zhuǎn)226、M242、204、M206到南山郵局即到
公交線路:坐車到南山郵局、億利達(dá)大廈、海雅百貨、新能源大廈下車即到
咨詢電話:0755-26412686
4、龍華教學(xué)點(diǎn):
上課地點(diǎn):龍華新區(qū)民治大道東邊商務(wù)大樓4樓4019室(即民治地鐵站口)
乘地鐵環(huán)中線到民治站D出口即到
公交線路:坐車到沙元埔下車即到
咨詢電話:0755-29831540
5、龍崗教學(xué)點(diǎn):
上課地點(diǎn):龍崗區(qū)深惠路地鐵3號(hào)線愛(ài)聯(lián)站創(chuàng)兆大廈1305室
公交線路:乘地鐵龍崗線到愛(ài)聯(lián)站B出口即到,坐車到愛(ài)聯(lián)地鐵站下車即到或愛(ài)聯(lián)小學(xué)站對(duì)面
咨詢電話:0755-28721555
6、西鄉(xiāng)教學(xué)點(diǎn):
上課地點(diǎn):寶安區(qū)西鄉(xiāng)金海路金海商務(wù)大廈A1棟6樓(即海灣中學(xué)對(duì)角)
乘地鐵羅寶線西鄉(xiāng)地鐵站B出口200米即到
公交線路:坐車到華輝盛大廈或錦欣花園下車即到
咨詢電話:0755-27338889
7、布吉教學(xué)點(diǎn)地址:
上課地點(diǎn):布吉鎮(zhèn)吉華路189號(hào)匯洋大廈11樓(即布吉中學(xué)對(duì)面)
乘地鐵環(huán)中線長(zhǎng)龍站B出口或公交坐到布吉中學(xué)下車,并直行200米到人行天橋處,麥當(dāng)勞、匯洋新概念酒店樓上
咨詢電話:0755-28272367
Siege(英文意思是圍攻)是一個(gè)壓力測(cè)試和評(píng)測(cè)工具,設(shè)計(jì)用于WEB開(kāi)發(fā)這評(píng)估應(yīng)用在壓力下的承受能力:可以根據(jù)配置對(duì)一個(gè)WEB站點(diǎn)進(jìn)行多用戶的并發(fā)訪問(wèn),記錄每個(gè)用戶所有請(qǐng)求過(guò)程的相應(yīng)時(shí)間,并在一定數(shù)量的并發(fā)訪問(wèn)下重復(fù)進(jìn)行。
說(shuō)明
ab的主要弱點(diǎn)在于它不能讓你模擬一個(gè)更加真實(shí)的請(qǐng)求分布——例如你想通過(guò)設(shè)置一個(gè)請(qǐng)求的列表來(lái)在這些列表之間來(lái)回測(cè)試,而siege就可以。
安裝
siege需要自己從http://www.joedog.org/上自己下載,然后編譯:
注意在configure的時(shí)候,一定要設(shè)置mandir參數(shù),否則當(dāng)你通過(guò) man siege查看siege幫助的時(shí)候會(huì)看不到他的manual.
wget http://www.joedog.org/pub/siege/siege-3.0.5.tar.gz
tar -zxf siege-2.67.tar.gz
./configure --prefix=/usr/local/siege --mandir=/usr/local/man
make
# 轉(zhuǎn)到超級(jí)用戶
make install
安裝完成后,運(yùn)行bin中的siege_config命令來(lái)創(chuàng)建.siege文件之后,你可以通過(guò)
./siege -C
命令來(lái)查看當(dāng)前配置
最簡(jiǎn)單的使用命令:
./siege http://localhost/
#用來(lái)測(cè)試本地主頁(yè)
參數(shù)介紹
-cNUM
設(shè)置并發(fā)的用戶(連接)數(shù)量. 默認(rèn)的連接數(shù)量可以到~/.siegerc中查看,指令為concurrent = x。比如-c10,設(shè)置并發(fā)10個(gè)連接
-rNUM
(repetitions),重復(fù)數(shù)量,即每個(gè)連接發(fā)出的請(qǐng)求數(shù)量,設(shè)置這個(gè)的話,就不需要設(shè)置-t了。對(duì)應(yīng).siegerc配置文件中的reps = x指令
-tNUM
(time),持續(xù)時(shí)間,即測(cè)試持續(xù)時(shí)間,在NUM時(shí)間后結(jié)束,單位默認(rèn)為分,比如-t10,那么測(cè)試時(shí)間為10分鐘,-t10s,則測(cè)試時(shí)間為10秒鐘。對(duì)應(yīng).siegerc中的指令為time = x指令
-b
(benchmark),基準(zhǔn)測(cè)試,如果設(shè)置這個(gè)參數(shù)的話,那么delay時(shí)間為0。man siege中有一句話這樣說(shuō):
it's not recommanded that you use this option while load testing.
說(shuō)明基準(zhǔn)測(cè)試和load testing 是完全不同的,至于有什么不同,可以閱讀BenchMarkingVSLoadTestingVSPerformance.
-f url.txt
(file),這是文件。對(duì)應(yīng).siegerc配置文件中的file = x指令
其他比較關(guān)注的測(cè)試方法,比如我想使用Keep-Alive方式進(jìn)行測(cè)試,可以在.siegerc配置文件中進(jìn)行修改,將connect = close改為 connect = keep-alive
另外您還可以通過(guò)-H HEADER參數(shù)來(lái)設(shè)置請(qǐng)求header。
結(jié)果說(shuō)明
Lifting the server siege… done.
Transactions: 3419263 hits //完成419263次處理
Availability: 100.00 % //100.00 % 成功率
Elapsed time: 5999.69 secs //總共用時(shí)
Data transferred: 84273.91 MB //共數(shù)據(jù)傳輸84273.91 MB
Response time: 0.37 secs //相應(yīng)用時(shí)1.65秒:顯示網(wǎng)絡(luò)連接的速度
Transaction rate: 569.91 trans/sec //均每秒完成 569.91 次處理:表示服務(wù)器后
Throughput: 14.05 MB/sec //平均每秒傳送數(shù)據(jù)
Concurrency: 213.42 //實(shí)際最高并發(fā)數(shù)
Successful transactions: 2564081 //成功處理次數(shù)
Failed transactions: 11 //失敗處理次數(shù)
Longest transaction: 29.04 //每次傳輸所花最長(zhǎng)時(shí)間
Shortest transaction: 0.00 //每次傳輸所花最短時(shí)間
EJB3 façade over Spring services
http://java.dzone.com/articles/ejb3-fa%C3%A7ade-over-springUsing Spring’s EJB implementation support classes
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/ejb.html#ejb-implementation-ejb3import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor;
import ch.frankel.blog.ejb.spring.service.client.RandomGeneratorService;
@Stateless
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class RandomGeneratorBean implements RandomGeneratorService {
@Autowired
private ch.frankel.blog.ejb.spring.service.RandomGeneratorService delegate;
@Override
public int generateNumber(int lowerLimit, int upperLimit) {
return delegate.generateNumber(lowerLimit, upperLimit);
}
}