0

I have a problem for haystack area, hope that some of you could give me some advice

In my application, each time the search request take long time, and haystack have a high CPU cost. here is some logs:

Building Trie..., from /Users/yonzhang/script/hss/hibox/demo/jieba/dict.txt

loading model from cache /var/folders/2y/nmm0yhhx3tx0mwjrt8yqztxr0000gn/T/jieba.cache

loading model cost 1.41886401176 seconds.

Trie has been built succesfully.

and sometimes I meet the error logs like this:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 86, in run
    self.finish_response()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
    self.write(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 212, in write
    self.send_headers()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
    self.send_preamble()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
    'Date: %s\r\n' % format_date_time(time.time())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 324, in write
    self.flush()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[08/Apr/2014 08:35:36] "GET /search?q=%E4%BA%A7%E5%93%81%E7%BB%8F%E7%90%86 HTTP/1.1" 500 59

thanks in advice~

yonzhang

yonzhang
  • 65
  • 5

1 Answers1

0

It seems that you cut every query for one request, and it loads the dict every time.

You can consider put word-cut as a service.

hahakubile
  • 6,978
  • 4
  • 28
  • 18