Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Groonga with MapKit

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Groonga with MapKit

Avatar for takatomo okitsu

takatomo okitsu

November 29, 2013
Tweet

More Decks by takatomo okitsu

Other Decks in Technology

Transcript

  1. • Mobage • Comm: Free calls, texts and fun! •

    Baseball Staduim LIVE • Peko: Play to be Paid! ؔΘͬͨϓϩμΫτ Now
  2. Ґஔ৘ใͷߋ৽ Groonga MySQL JSONRPC Server JSONRPC load (over http) response

    latitude / longtitude save iOSͷLocationAPIͰ Ң౓ܦ౓औಘ
  3. ※ಛఆͷൣғʹ͍ΔϢʔβͷݕࡧ Groonga MySQL JSONRPC Server JSONRPC ϢʔβҰཡ ӈ্ʢ๺౦ʣͷlatitude / longtitude

    sql ࠨԼʢೆ੢ʣͷlatitude / longtitude + geo_in_circleͰϑΟϧλ Ґஔ৘ใͷݕࡧ ϢʔβҰཡ ϢʔβҰཡ select (over http)
  4. iOSʹ͓͚Δൣғͷಛఆํ๏ CGPoint northEast = CGPointMake( self.mapView.bounds.origin.x+self.mapView.bounds.size.width, self.mapView.bounds.origin.y ); CLLocationCoordinate2D convertNorthEast

    = [self.mapView convertPoint:northEast toCoordinateFromView:self.mapView]; CGPoint southWest =CGPointMake( self.mapView.bounds.origin.x, self.mapView.bounds.origin.y+self.mapView.bounds.size.height ); CLLocationCoordinate2D convertSouthWest = [self.mapView convertPoint:southWest toCoordinateFromView:self.mapview];
  5. - (void)mapView:(MKMapView*)mapView regionDidChangeAnimated:(BOOL)animated { [self performSelector:@selector(updateDisplayedRegionUsers) withObject:self afterDelay:2.0]; } -

    (void)mapView:(MKMapView*)mapView regionWillChangeAnimated:(BOOL)animated { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(updateDisplayedRegionUsers) object:nil]; } MapΛϑϦοΫ/εϫΠϓͯ͠Ҡಈͨ͠৔߹ͷ ߋ৽ํ๏ • Ґஔͷมߋ͕ߦΘΕ͔ͯΒɺ2ඵޙʹαʔό͔Β࠶औಘ͢Δɻ • 2ඵҎ಺ʹ࠶౓Ґஔͷมߋ͕ߦΘΕͨΒɺऔಘΛΩϟϯηϧ͢Δɻ
  6. ඇಉظ→ಉظͩͱύϑΥʔϚϯε͕ ؾʹͳΔ → ϕϯνͱͬͨ API (※1) ϦΫΤετ਺ ฏۉϨεϙϯε λΠϜ(s) εϧʔϓοτ

    (ϦΫΤετ਺/s) updateLocation ʢҐஔ৘ใͷߋ৽ʣ 101892 0.358 s 550.3 searchUserByRegion ʢҐஔ৘ใͷݕࡧʣ 109224 0.380 s 449.7 ※1 JSONRPCαʔόͷAPI໊Ͱ͢ɻ͜ͷAPIͷதͰಉظతʹGroongaΛ͍ͨͨͯ·͢ɻ JSONRPCαʔό୆਺ : 2୆ ʢϋʔυεϖοΫ๨Εͨɻੴڮ͞Μʹ֬ೝ͠·͢ʣ JSONRPCαʔόworker਺ : 200 Groongaαʔό୆਺ : 2୆ ΫϥΠΞϯτଟॏ౓ : ඵؒ200ϦΫΤετ ༨༟Ͱڐ༰ൣғ
  7. खॱͦͷ1 Groonga-1 load Groonga-2 JSONRPC αʔό update location ✗ •

    Groonga-2Λӡ༻͔Βൈ͍ͯɺGroonga-1ʹߋ৽ɾࢀর ΛدͤΔ ✗
  8. MapʹҰ౓ʹͨ͘͞ΜPinΛͨͯΔͱ ॏ͘ͳΔ͠͏͍͟ • ҰճͷݕࡧͰɺͨ͘͞ΜͷσʔλΛදࣔͯ͠͠·͏ͱ͏͍͟ɻ (લͷϖʔδͷΑ͏ʹͳΔʣ • ͳͷͰ1ճͷݕࡧͷϨεϙϯε͸25݅ఔ౓ʹ͓͍͑ͯ͞Δɻ • ্هͷߜΓࠐΉϩδοΫ͸ɺMap্ʹ͏·͘෼ࢄͤ͞ΒΕΔʢਅΜதʹूத͠ͳ ͍ʣΑ͏ʹ޻෉͍ͯ͠Δɻ

    ※શମͷώοτ݅਺͔Βɺ25ਓఔ౓ʹ͓͑͞ΒΕΔΑ͏ʹɺ_key(user_id)Λม਺ Ͱׂͬͨ༨Γ͕5ͷϢʔβ͚ͩऔಘ͢Δͱ͔ɺͦ͏͍͏ΫΤϦΛ౤͍͛ͯΔɻ • MapΛ֦େ͍ͯ͘͜͠ͱͰɺର৅Ϣʔβ͕ঃʑʹߜΓ͜·Ε͍ͯ͘ͷͰɺ࠷ऴత ʹ͸͢΂ͯͷϢʔβ͕දࣔͰ͖ΔΑ͏ʹͳΔɻ • ͜ͷ͋ͨΓ͸΋ͬͱվળͰ͖Δ͔ͳɻ
  9. ޚྱ • ͙ʹΌΒ͞Μʂ • ITج൫ ੴڮ͞Μʂ • mitz͞Μʂ@t_mitz • Yosaku

    ToyamaʂʢPekoͷGroonga୲౰ʣ • Groonga։ൃʹؔΘͬͯΔօ༷ʂʂʂ