On Fri, Oct 25, 2013 at 9:06 PM, ray <yehray...@gmail.com> wrote: > Hi all, > The system use ONE tcpip client and connection to server. > A large batch transactions send to server.I want to send to server > concurrently. > any idea ? > In my thinking, > A.Devide large batch transactions to small batch transactions. > B.Create multi-thread or multiprocessing to process small transactions. > C.No idea at how to control multithread using ONE client concurrently? > Each small transactions do not need to wait others > Thank for your suggestions.
Are you able to open multiple TCP/IP connections to the server and run them in parallel? If not, you're going to be limited to what the server can do for you. Otherwise, though, it's just a matter of working out how best to manage multiple connections. * You can manage everything with a single thread and asynchronous I/O. This would probably be easier if you're on Python 3.4, but it's possible with any version. * Or you can spin off threads, one for each connection. This can work nicely, but if you don't know how to get your head around threads, you may confuse yourself, as has been recently discussed in other threads (discussion threads, that is, not threads of execution - what a crackjaw language this English is!). * Or you can use the multiprocessing module and divide the work into several processes. Again, you have to figure out what you're doing where, but this can in some ways be a lot easier than threading because each process, once started, is completely separate from the others. * Or, rather than manage it within Python, you could simply start multiple independent processes. Somehow you need to figure out how to divide the transactions between them. Could be really easy, but could be quite tricky. I suspect the latter, in this case. There are many ways to do things; figuring out which is the One Obvious Way demands knowledge of what you're trying to achieve. Do any of the above options sound good to you? ChrisA -- https://mail.python.org/mailman/listinfo/python-list