我觉得,主要的问题在于你GPS是一直在修改的,因为车辆在不断的行驶,这样的话,可能会影响数据库的性能
我觉得,你可以用一个内存行的数据库,比如,redis,用这个来存放GPS信息,redis是基于内存的,读写要比关系数据库速度快(忽略网络因素),你可能要问GPS入库怎么弄,可以做一个定时任务,每隔多少时间来将redis的数据写入到数据库中,当然,redis也支持一些算法,比如LRU,来设置何时将数据同步到数据库
整个架构部署用到了集群部署(1:2)、动静分离、缓存服务、拆分数据库等高并发处理技术,属于大型系统的模型。
据我所知,集群1:2是1负载分发器、2web服务器,(以Apachetomcat集群为例),那么Directorserver应该安装Apache,而RealServer应该安装tomcat,至于javaweb项目在tomcat下面即可。
而你的架构图中还有动静分离机制,理论上静态文件服务器也应该有javaweb项目才对,不然静态文件服务器如何取静态文件呢。tomcat对静态文件处理不是很好,所以很多人推荐用Nginx作为载体。
缓存和集群数据库我不了解,不发表任何谬论。
session会话就是指的>
建议看下一些集群架构方面的书籍,比如《大型网站系统与java中间件实践》。
首先不要管安卓端还是苹果端,现在一般都是响应式的app,你放到安卓或者苹果或者pc或者平板都是没有问题的。一般采用的是>客户端简单代码:Imports SystemNetSockets
Imports SystemIO
Private Output As NetworkStream
Private Writer As BinaryWriter
Private Reader As BinaryReader
Dim StrSend As String
Dim client As New TcpClient '
clientConnect(servIP, 2006)
Output = clientGetStream
Writer = New BinaryWriter(Output)
Reader = New BinaryReader(Output)
StrSend = "字符串"
SystemThreadingThreadSleep(100)
WriterWrite(StrSend)
Try
Message = ReaderReadString
If Message = "OK" Then
LBinfoText = "成功!" '测试
Else
LBinfoText = "失败!"
End If
SystemThreadingThreadSleep(100)
Catch ex As Exception
MessageBoxShow("Client Application Closing!")
Finally
WriterClose()
ReaderClose()
OutputClose()
clientClose()
End Try
服务器端
用线程
Imports SystemNetSockets
Imports SystemIO
Imports SystemThreading
Imports SystemWindowsForms
Private Connection As Socket
Private readThread As Thread
Private SocketStream As NetworkStream
Private Writer As BinaryWriter
Private Reader As BinaryReader
Public Sub New()
MyBaseNew()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
readThread = New Thread(AddressOf RunServer)
readThreadStart()
End Sub
Public Sub RunServer()
Dim Listener As TcpListener
Try
Listener = New TcpListener(NetIPAddressParse("192168116"), 2006)
ListenerStart()
While True
Connection = ListenerAcceptSocket 'accept an incoming connection
SocketStream = New NetworkStream(Connection) 'create networkstream object associated with socket
Writer = New BinaryWriter(SocketStream) 'create object for transferring data across stream
Reader = New BinaryReader(SocketStream) 'read string data sent from client
Try
Do
strIncept = ReaderReadString
strIncept = DataDisp(strIncept) '此处插入数据处理程序()
SendInfoToClient(strIncept) 'send to client
Loop While ConnectionConnected
Catch ex As Exception
MsgBox(exToString)
Finally
WriterClose()
ReaderClose()
SocketStreamClose()
End Try
End While
Catch ex As Exception
MsgBox(exToString)
End Try
End Sub
Public Sub SendInfoToClient(ByVal Info As String)
'Send to client
Try
If ConnectionConnected Then
WriterWrite(Info)
ConnectionClose()
End If
Catch ex As SocketException
MessageBoxShow(exToString)
End Try
End Sub
整个过程都有了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)