Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python inserts Hbase experiment through Thrift

2025-02-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

# python

From thrift import Thrift

From thrift.transport import TSocket

From thrift.transport import TTransport

From thrift.protocol import TBinaryProtocol

From hbase import Hbase

From hbase.ttypes import *

Transport = TSocket.TSocket ('192.168.137.101)

Transport = TTransport.TBufferedTransport (transport)

Protocol = TBinaryProtocol.TBinaryProtocol (transport)

Client = Hbase.Client (protocol)

Transport.open ()

Mutations = [Mutation (column= "tuser:b", value= "1")]

# client.mutateRow ('ttable0','rowkey1', mutations, None)

For L1 in range (10):

For L2 in range (10):

For L3 in range (10):

For L4 in range (10):

Client.mutateRow ('ttable0','%d'%l1+'%d'%l2+'%d'%l3+'%d'%l4, mutations, None)

Print 'finished'

4 centos virtual machines

2.2Ghz CPU × 1

1.5GB memory

Share a single hard disk

It took 93 seconds to insert 1000 entries, with an average of 107s per second.

Copy 0.py to 1.py, 2.py... 8.py

Start 9 processes to insert ttable0, ttable1, ttable2. Ttable8

Other conditions remain unchanged, with a total time of about 220 seconds, with an average of 409 entries per second.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report