./mm --repl now very slow. Why?
Closed this issue · 5 comments
Probably config server replset stuff that was added?
Tests are aso painfully slow...
rhysmacbook:tests rhys1$ python test_pymmo.py
Executed setup in 262.452080011 seconds
..
Run profiling with...
python -m cProfile -o output_profile.dat mm --repl
View the data with...
import pstats
p = pstats.Stats('output_profile.dat')
p.sort_stats('cumulative').print_stats(10)
Sat Dec 10 17:49:16 2016 output_profile.txt
1316693 function calls (1315428 primitive calls) in 101.033 seconds
Ordered by: cumulative time
List reduced from 1010 to 10 due to restriction <10>ncalls tottime percall cumtime percall filename:lineno(function)
1 0.003 0.003 101.034 101.034 mm:12()
12 0.000 0.000 100.904 8.409 /Library/Python/2.7/site-packages/pymongo/database.py:874(authenticate)
12 0.000 0.000 100.903 8.409 /Library/Python/2.7/site-packages/pymongo/mongo_client.py:364(_cache_credentials)
1 0.000 0.000 100.813 100.813 /Users/rhys1/Documents/github_projects/mmo/python/app/../pymmo/pymmo.py:411(mmo_replication_status_summary)
10 0.000 0.000 100.794 10.079 /Users/rhys1/Documents/github_projects/mmo/python/app/../pymmo/pymmo.py:74(mmo_connect_mongod)
1 0.000 0.000 90.733 90.733 /Users/rhys1/Documents/github_projects/mmo/python/app/../pymmo/pymmo.py:376(mmo_replication_status)
1 0.000 0.000 90.732 90.732 /Users/rhys1/Documents/github_projects/mmo/python/app/../pymmo/pymmo.py:305(mmo_execute_on_primaries)
57 0.000 0.000 50.065 0.878 /Library/Python/2.7/site-packages/pymongo/topology.py:110(select_server)
57 0.088 0.002 50.064 0.878 /Library/Python/2.7/site-packages/pymongo/topology.py:62(select_servers)
108 0.000 0.000 50.057 0.463 /Library/Python/2.7/site-packages/pymongo/server.py:97(get_socket)
The following calls are very slow...
socket.getaddrinfo("rhysmacbook.local", 30009)
But localhost is fast.
Solved
local issue. Hosts file contained the following...
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 rhysmacbook
127.0.0.1 rhysmacbook.local
Updating to this resolved the issue...
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 rhysmacbook
127.0.0.1 rhysmacbook.local
::1 rhysmacbook
::1 rhysmacbook.local