Professional Documents
Culture Documents
Chotima Channukul
2552
..
2552
. .
. .
II
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
2
2.1 Load Balance
- 2.1.1 Round Robin DNS
- 2.2.2 Random Redirection
- 2.2.3 Load Balancer
2.2 Cluster Computing
- 2.2.1
- 2.2.2
- 2.2.3 Cluster Computing
- 2.2.4
2.3 World Wide Web : HTTP
- 2.3.1 HTTP
- 2.3.2 (HTTP Message)
- 2.3.3 HTTP Response Message
l
II
III
lV
VII
1
1
2
2
2
2
2
3
3
4
4
4
5
5
7
7
8
8
9
10
11
11
12
III
()
2.4
- 2.4.1
- 2.4.2
2.5
- 2.5.1 A Scalable HTTP Server: The NCSA Prototype
- 2.5.2 Scalable Web Server Architectures
- 2.5.3 Network Dispatcher: a Connection Router for Scalable
Internet Services
- 2.5.4 High Performance Web-Server Systems
- 2.5.5 Redirection Algorithms for Load Sharing in Distributed
Web-Server Systems
- 2.5.6 Dynamic Load Balancing on Web-Server Systems
- 2.5.7 Load Balancing a Cluster of Web Servers Using
Distributed Packet Rewriting
- 2.5.8 Load Distribution via Static Scheduling and Client Redirection
for Replicated Web Servers
- 2.5.9 Locality-Aware Request Distribution in Web Server Clusters
- 2.5.10 Efficient Support for Content-based Routing in
Web Server Clusters
- 2.5.11 Scalable Content-aware Request Distribution in
Cluster-based Network Servers
- 2.5.12 Summary Cache
- 2.5.13 Cache Digests [1]
- 2.5.14 An Adaptive Load Balancing Algorithm
Using Simple Prediction
12
12
13
13
13
13
13
13
14
14
14
14
15
15
15
15
16
16
IV
()
3
3.1
- 3.1.1
3.2 3
- 3.2.1 1 Scrip Load Balance
- 3.2.2 2 Application Scan Streaming
- 3.2.3 3 Database
3.3
3.4
- 3.4.1
- 3.4.2
17
17
17
18
18
19
20
20
21
21
30
4
4.1
4.2
4.3
5
5.1
5.2
5.3
41
41
44
46
47
47
48
48
49
51
52
45
45
46
46
VI
4
5
6
10
17
18
19
20
41
42
42
42
43
44
VII
1
Load Balance Web server
1.1
Google
5. load Balance
1.2
1.
Load Balancer
Server Request User Request
Load Balancer Forward Request Server
1.3
1. Load Balance
2.
3.
1.4
1. Load Balance Web Server
2.
3. Server 3
4.
5.
1.5
1.
2.
3. Load Balancing
4.
5.
6.
7.
1.6
1. Load Balancing
2.
3.
4.
1.7
5
1
2
3
4
5
1.8
2552/1
.
1.
2.
3.
4.
5.
2552/2
. .
1.
2.
3.
4.
5.
2.
2.1 Load Balance
2.1.1 Round Robin DNS Feature DNS register domain
ip address
Round Robin load
real-time register server load
mapping dns cache
User
User
User
Distribute
User
User
Server1
User
Server2
www ftp
(Node)
Front-end Node
Compute Node
Network
Information System (NIS) (User)
(Login)
,
, (Parallel
Computing)
Cluster Computing Grid (Grid Computing)
Cluster Computing
(Platform) Grid
Computing
Cluster Computing Load balancing
Cluster Computing
Clustering
(Replication) Web Application Session Replication
Session Web Server Clustering
8
Load Balancer
Load Load
Cluster Feature Server Develop
Application Cluster Feature Server
File Sharing Database Load Balance
Hardware Software Load Balancer
Application Traffic Server
Redirection
(Parallel Processing)
2.2.4
Custer Computing 1
1 (CPU)
CPU, ROM, RAM
Feature Load
Balance Clustering
(Personal Computer : PC)
Beowulf Cluster
PC
PC Cluster
Software (Linux)
(Open Source) , MPI
(Message Passing Interface) PVM (Parallel Virtual Machine)
TP
HT
s
Re
T
HT
e
ns
po
es
qu
e
R
Internet
2.4 HTTP
10
2.3.1 HTTP
HTTP
TCP/IP ()
2.1
URL (Uniform Resource Locator)
(Address) (HTTP
Request)
URL (HTTP Response)
HTTP
2.3.2 (HTTP Message)
HTTP 1.1 (HTTP/1.1)
(HTTP Request Messags)
(HTTP Response Message)
- HTTP Request Message
11
HTML POST
Host : www.gitex.co.th
URL www.gitex.co.th
User Agent: Mozilla/4.0
HTTP/1.1 200 OK
Connection : close
Date : Thu, 06 Aug 2003 12:00:15 GMT
Server : Apache/2.0.4 (Unix)
Last-Modified: Mon , 22 Jun 2003 09:23:24 GMT
Content-Length : 6821
Content-Type : text/html
(data data data data data.)
3
(Status Line) 6
3
HTTP
HTTP 1.1
2.4
2.4.1
Static Load Distribution
12
2.4.2
Location Policy
State Polling Information Policy
Transfer Policy
2.5
2.5.1 A Scalable HTTP Server: The NCSA Prototype
(Round Robin)
2.5.2 Scalable Web Server Architectures
HTTP Redirect
2.5.3 Network Dispatcher: a Connection Router for Scalable Internet
Services
(Router)
IP Packet Forwarding
2.5.4 High Performance Web-Server Systems
Mirror Sites
13
14
15
16
3
3.1
nd
Re
qu
es
Count
192.168.1.2
192.168.1.3
192.168.1.4
Se
nd
Re
qu
e
st
Se
IP
nd
Se
t
da
Se
n
da
ta
3.1
3.1.1
Client Web Server Scrip Load Balance
redirect Server Database
Server 1, 2, n Real Time
3.2 3
3.2.1 1 Scrip Load Balance Web Server Load Balance
Database
Client Server
Start
Client
Scrip Load
Balance
Database
Server 1
(ip address 1)
Server N
(ip address N)
18
Start
Get
netstat -n
ip address
port 80
Client
Count
Database
19
3.2.3 3 Database
2 ip Server 1, 2, n
Client
20
3.4
2 IIS Server
XP SQL Server 2005
3.4.1
XP
IIS
1. Start > Settings > Control Panel
2. Add or Remove Programs
3. Add/Remove Windows Components
21
5. Next>
6. Windows XP OK Browse CD
Windows XP i386
22
23
7. Open, OK
8. IIS
24
9. Finish
IIS
1. My Computer > Manage
25
2. Services and Applications > Internet Information Services > Web Sites >
Default Web Site
26
5. Home Directory
Local Path : <drive:\>Inetpub\wwwroot
[ ] Script source access :
[ / ] Read :
[ ] Write :
[ ] Directory browsing :
[ / ] Log visits :
[ / ] Index this resource : index
27
Configuration...
28
6. Document
Home Page Add
index.html > HTML
index.shtml > SHTML
index.asp > ASP
index.aspx > ASP.NET
ASP index.html, index.asp
29
7. OK
8. Stop Start IIS 1
9. IIS
3.4.2
SQL Server 2005
1. SQL Server 2005 SQLEXPR_ADV
SQLEXPR_ADV
30
2. > Next
3. Install
31
4. Next
5. Next
32
6. Next
33
8. Tool Patch
Database Database Services
9. Next
34
35
12. Use the bult-in System account > Network service Local
System > Next
13. Mixed Mode (Windows Autentication and SQL Server Authentication) >
Password
Enter password : ( password sa )
Confirm password : ( password sa )
14. Next
36
15. Next
16. Next
37
17. Next
18. Next
38
19. Install
20. Next
39
21. Finish
22. OK
40
Web Server
4.1
1 Scrip Load Balance Web Server DNS
Register IP Client 4.1 Private
Server Server Server
Private Server
4.2 4.3 Private Server
4.1
41
4.2
4.3
2 Scan Streaming Private Server IP Address
Port
2
3
4
5
42
3
4 Username
5 Password
6
Save
Start
Change
IP Address port 80 Server
netstat n 4.5 Server IP 192.168.1.3 port 80 IP
192.168.1.20 Server IP 192.168.1.3 4.6
4.5 netstat -n
43
4.6
4.2
Load Balance 2
- Client
- Private Server
44
/
4.1 Load Balance Server 2
( )
IP
1
2
3
4
5
6
7
8
9
10
Private
Server
192.168.1.2
/
/
/
/
/
/
/
/
/
/
192.168.1.3
192.168.1.4
45
( )
IP
Private
2
3
4
5
6
Server
192.168.1.2
/
/
/
/
/
192.168.1.3
( )
IP
Private
2
3
4
5
6
Server
x
x
192.168.1.2
/
/
/
192.168.1.3
192.168.1.4
4.3
Load Balance
Client 20 Private Server 2 Load Balance
Load
Balance
46
5.1
Round Robin DNS
session
Private Server
CPU RAM Private Server
1.
2.
3.
4.
5.
6.
Private Server
Load Balance
5.2
Web Server Windows XP
VB.net Server VMware
Computer, Switch, LAN Card
5.3
5.2.1
CPU RAM Server
5.2.2 Load Balance
Web Server Google Load Balance
Bandwidth Internet Caf
5.2.3 Load Balance
48
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
Alex Rousskov and Duane Wessels. Cache Digests. Proceedings of the 3rd
International WWW Caching Workshop, Manchester, England , June 1998.
TERENA, Trans-European Research and Education Networking
Association.
Antoine Mourad and Huiqun Liu. Scalable Web Server Architectures.
Proceedings of the IEEE Symposium on Computers and Communications
(ISCC97),Alexandria, Egypt, July 1997.
Chu Sing Yang and MonYen Luo. Efficient Support for ContentBased
Routing in Web Server Clusters. USENIX Symposium on Internet
Technologies and Systems, Boulder, Colorado, USA, October 1999.
Eric Dean Katz, Michelle Butler and Robert McGrath. A Scalable HTTP Server:
The NCSA Prototype. Computer Networks and ISDN Systems, 1994.
Gil-Haeng Lee, Wang-Don Woo and Byeong-Nam Yoon. An Adaptive Load
Balancing Algorithm Using Simple Prediction Mechanism. Proceedings of
th
the 9 International Database and Expert Systems Applications Workshop,
496-501, 1998.
Guerney D.H. Hunt, German S. Goldszmidt, Richard P. King and Rajat
Mukherjee. Network Dispatcher: a connection router for scalable Internet
th
services. Proceedings of the 7 International World Wide Web Conference,
Brisbane, Australia, April 1998.
Li Fan, Pei Cao, Jussara Almeida and Andrei Z. Border. Summary Cache: A
Scalable Wide-Area Web Cache Sharing Protocol. IEEE/ACM
Transactions on Networking, 8(3):281-293, June 2000.
Luis Aversa and Azer Bestavros. Load Balancing a Cluster of Web Servers Using
Distributed Packet Rewriting. Proceedings of the IEEE International
Performance, Computing, and Communications Conference, Phoenix, AZ
USA, February 2000.
49
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
Mohit Aron et al, Darren Sanders, Peter Druschel and Willy Zwaenepoel.
Scalable ContentAware Request Distribution in Clusterbased Network
Servers. Proceedings of the 2000 USENIX Annual Technical Conference,
SanDiego, CA USA, June 2000.
Valeria Cardellini, Michele Colajanni and Philip S. Yu. Dynamic Load
Balancing on Web-Server Systems. IEEE Internet Computing, 3(3):28-39,
May-June 1999.
Valeria Cardellini, Michele Colajanni and Philip S. Yu. Redirection Algorithms
for Load Sharing in Distributed Web-Server Systems. Proceedings of the
th
19 International Conference on Distributed Computing Systems, Austin,
Texas, June 1999.
Vivek S. Pai, Mohit Aron, Gauray Banga, Michael Svendsen, Peter Druschel,
Willy Zwaenepoel and Erich Nahum. LocalityAware Request
th
Distribution in Clusterbased Network Servers. Proceedings of the 8
ACM Conference on Architectural Support for Programming Languages
and Operating Systems, Sanjose, CA USA, October 1998.
Valeria Cardellini, Michele Colajanni and Philip S. Yu. High Performance Webth
server Systems. Proceedings of the 13 International Symposium on
Computer and Information Sciences, Ankara, Turkey, October 1998.
Wenting Tang and Matt W. Mutka. Load Distribution via Static Scheduling and
client Redirection for Replicated Web Servers. Proceedings of the
International Workshop on Scalable Web Services (in conjunction with
ICPP00), Toronto, Ontario, Canada, August 2000.
Alteon Personal Content Director [Online]. Available from :
http://www.westcon.uk/alteon/alteonprodinfoPCD.htm [2001, Sep 17]
Network Simulation2 [Online]. Available from : http://www.isi.edu/nsnam/ns
[2002, Jan 10]
Yahoo [Online]. Available from : http://www.yahoo.com [2001, Aug 14]
50
1.
1.1 Code Connection database
Public Class clsManageSQL
Private conn As SqlConnection
Private comm As SqlCommand
Private tr As SqlTransaction
Private strcon As String = "Data Source=" &
ConfigurationManager.AppSettings("HOST") & ";User ID=" &
ConfigurationManager.AppSettings("Username") & ";PWD=" &
ConfigurationManager.AppSettings("Password") & ";initial catalog=" &
ConfigurationManager.AppSettings("DatabaseName") & ";Max Pool
Size=2000;Connect Timeout=600"
Public Function Open() As Boolean
Try
conn = New SqlConnection
comm = New SqlCommand
With conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strcon
.Open()
Return True
End With
Catch ex As Exception
Throw New Exception("{clsManageSQL.open}" & ex.Message & "
" & Now)
Return False
End Try
End Function
Public Sub Dispose()
conn.Close()
conn.Dispose()
comm.Dispose()
End Sub
Public Function ExecuteDataHaving(ByVal sql As String) As Boolean
Try
Dim rd As SqlDataReader
comm.CommandType = CommandType.Text
comm.CommandText = sql
comm.Connection = conn
rd = comm.ExecuteReader()
If rd.Read Then
52
rd.Close()
Return True
Else
rd.Close()
Return False
End If
Catch ex As Exception
Throw New Exception("ExecuteDataHaving" & ex.Message)
Finally
End Try
End Function
Public Sub ExecuteNonQuery(ByVal sql As String)
Try
comm.Connection = conn
tr = conn.BeginTransaction
comm.Transaction = tr
comm.CommandType = CommandType.Text
comm.CommandText = sql
comm.ExecuteNonQuery()
tr.Commit()
Catch ex As Exception
' Throw New Exception("clsManageSql Error:
{ExecuteNonQuery}-" & ex.Message)
tr.Rollback()
End Try
End Sub
Public Function ExecuteDataTable(ByVal sql As String) As DataTable
Dim da As SqlDataAdapter
Dim ds As New DataSet
conn = New SqlConnection
comm = New SqlCommand
With conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strcon
.Open()
End With
da = New SqlDataAdapter(sql, strcon)
da.Fill(ds, "table")
Return ds.Tables(0).Copy()
End Function
Public Function getMaxID(ByVal tableName As String, ByVal fdIdxName
As String) As Integer
Try
Dim sql As String
Open()
Dim rd As SqlDataReader
53
sql = "select max(" & fdIdxName & ")as maxID from " &
tableName
comm.CommandType = CommandType.Text
comm.CommandText = sql
comm.Connection = conn
rd = comm.ExecuteReader()
If rd.Read Then
Return CInt(rd("maxID")) + 1
Else
Return 1
End If
Catch ex As Exception
Return 1
Finally
Dispose()
End Try
End Function
End Class
54
End Class
2. Code ScanStreaming
Public Class Form1
Dim timing As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.tbIP_SERVER.Text = My.Settings.IP_SERVER
Me.tbDB_HOST.Text = My.Settings.DBHost
Me.tb_DB_NAME.Text = My.Settings.DBName
Me.TB_USER.Text = My.Settings.DBUsername
Me.TB_PASS.Text = My.Settings.DBPassword
Me.tbTimer.Text = My.Settings.TIMER
End Sub
proc.WaitForExit()
Dim arr As New ArrayList
Dim sr As New StringReader(output.ToString())
'
line = Nothing
Dim lineRead As String
Dim str As String = ""
Do While (True)
Dim strTmp As String
lineRead = sr.ReadLine
55
str = arrTmp1(0).Trim
If arr.Count > 0 Then
For i As Integer = 0 To arr.Count - 1
If arr(i) = str.Trim Then
Exit For
Else
If i = arr.Count - 1 And arr(i) <>
str.Trim Then
arr.Add(str.Trim)
End If
End If
Next
Else
arr.Add(str.Trim)
End If
End If
Try
56
arr = scan()
If arr.Count > 0 Then
updateDB(arr.Count)
Else
updateDB(0)
End If
Catch ex As Exception
' MsgBox(ex.Message)
End Try
End Sub
Me.Timer1.Enabled = True
End Sub
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
57
Me.tbDB_HOST.ReadOnly = True
Me.tb_DB_NAME.ReadOnly = True
Me.TB_USER.ReadOnly = True
Me.TB_PASS.ReadOnly = True
Me.tbTimer.ReadOnly = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Try
Me.tbIP_SERVER.ReadOnly = False
Me.tbIP_SERVER.ReadOnly = False
Me.tbDB_HOST.ReadOnly = False
Me.tb_DB_NAME.ReadOnly = False
Me.TB_USER.ReadOnly = False
Me.TB_PASS.ReadOnly = False
Me.tbTimer.ReadOnly = False
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Try
If timing = My.Settings.TIMER Then
Me.lbStatus.Text = "Done."
timing = 0
Process()
Else
Me.lbStatus.Text = "Process"
timing += 1
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
58
End Sub
End Class
59