anchor.diff:  -define(GEO_TABLE, mt_geo).
   -define(GEO_MANAGER, geoman).
   -define(HIGH_WATER_MARK, 1000).
  +-define(SNAPSHOT_INTV, 86400*1000).
  +-define(WRITEBACK_THR, 100000).
   
   start(Port, Threads) ->
       inets:start(),
  
positive.code: -module(geoip).
  -author('wuhualiang@meituan.com').
  
  -export([start/2]).
  
  -define(DEV, _).
  -ifdef(DEV).
  -export([http_response/2]).
  -endif.
  
  -define(IPS_FILE, "ips.dump").
  
negative.code:     % ets:new(?GEO_TABLE, [set, public, named_table])
      {ok, ?IPS_TABLE} = ets:file2tab(?IPS_FILE),
      {ok, ?GEO_TABLE} = ets:file2tab(?GEO_FILE),
      GeoMan = spawn(geoman),
      register(?GEO_MANAGER, GeoMan),
      lists:map(fun worker_init/1, [0, Threads-1]),
      {ok, LSock} = gen_tcp:listen(Port, []),
      listen(Port).
  
  %% ======== Internal Functions ======== %%
  
  listen(Port) ->
     ok. 
  
  snapshot() ->
      timer:sleep(?SNAPSHOT_INTV),
      {{Y, M, D}, {H, Mi, S}} = calendar:local_time(),
      Suffix = "." ++ integer_to_list(Y * 10000 + M * 100 + D) ++
               "-" ++ integer_to_list(H * 10000 + Mi * 100 + S),
      ets:tab2file(?IPS_TABLE, ?IPS_FILE ++ Suffix),
      ets:tab2file(?GEO_TABLE, ?GEO_FILE ++ Suffix),
      snapshot().
  
  worker_init(X) when is_integer(X) ->
      Tid = ets:new(taskqueue, [set, public]),
  