Top Banner
Apache Solr @somkiat
28

เกี่ยวกับ Apache solr 4.0

Jan 26, 2015

Download

Technology

1. แนะนะเกี่ยวกับ Apache Solr 4.0
2. การใช้งาน Admin
3. การ Scale ระบบงาน
4. เครื่องมือการทดสอบประสิทธิภาพ
5. การ tunning ขั้นพื้นฐาน
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: เกี่ยวกับ Apache solr 4.0

Apache Solr@somkiat

Page 2: เกี่ยวกับ Apache solr 4.0

Apache Solr

Search server

Based on Lucene

Full-text search library

Java 100%

Open source

Page 3: เกี่ยวกับ Apache solr 4.0

Apache SolrREST API

HTTP

XML

JSON

Page 4: เกี่ยวกับ Apache solr 4.0

Apache SolrClient supports

.NET

Java

PHP

Ruby

Python

Page 5: เกี่ยวกับ Apache solr 4.0

How we implement ?

Page 6: เกี่ยวกับ Apache solr 4.0

SELECT * FROM product

WHERE id LIKE ‘%1%’ AND name LIKE ‘%xxx%’

Page 7: เกี่ยวกับ Apache solr 4.0

Problems

Full table scan = Killer performance

RDBMS is not designed for search like that

Page 8: เกี่ยวกับ Apache solr 4.0

Architecture

Indexer

Apache Solr

WEB Application

Query

ResultUpdate

Page 9: เกี่ยวกับ Apache solr 4.0

How to use ?Install

Define solrconfig.xml

Define schema.xml

Deploy to Java Web Server

Jetty ( Default )

Apache Tomcat

Page 10: เกี่ยวกับ Apache solr 4.0

Define schema.xml

Structure of data

Liked table structure

Must have Primary/Unique key

Must have _version_ field

Page 11: เกี่ยวกับ Apache solr 4.0

<field name="id" type="string" indexed="true" stored="true" required="true" /> !

<field name="item_id" type="string" indexed="true" stored="true" required="true" /> <uniqueKey>id</uniqueKey>

Page 12: เกี่ยวกับ Apache solr 4.0

Solr Administrator

http://localhost:8983/solr

Page 13: เกี่ยวกับ Apache solr 4.0

Dashboard page

Page 14: เกี่ยวกับ Apache solr 4.0

Add/Update index

Page 15: เกี่ยวกับ Apache solr 4.0

Add/Update Index

http://localhost:8983/solr/collection1/update?wt=json

Page 16: เกี่ยวกับ Apache solr 4.0

Delete Index

http://localhost:8983/solr/collection1/update?stream.body=<delete><query>*:*</query></delete>&commit=true

Page 17: เกี่ยวกับ Apache solr 4.0

Ping

http://localhost:8983/solr/collection1/admin/ping?wt=json

Page 18: เกี่ยวกับ Apache solr 4.0

Scaling SolrScale up

CPU, RAM, SSD

Scale horizontal

(http://wiki.apache.org/solr/DistributedSearch)

Scale deep

Sharding and Multiple replicate

Page 19: เกี่ยวกับ Apache solr 4.0

Performance ToolsJMeter

SolrMeter

https://code.google.com/p/solrmeter/

http://wiki.apache.org/solr/BenchmarkingSolr

Page 20: เกี่ยวกับ Apache solr 4.0

JMeter

Page 21: เกี่ยวกับ Apache solr 4.0

SolrMeter

Page 22: เกี่ยวกับ Apache solr 4.0

Tuning performance

http://wiki.apache.org/solr/SolrPerformanceFactors

Page 23: เกี่ยวกับ Apache solr 4.0

JVM Memory

-Xms1024M -Xmx1024M -server

Page 24: เกี่ยวกับ Apache solr 4.0

Virtual Memory

Virtual memory for index

Config in solrconfig.xml

<directoryFactory/>

change from StandardDirectoryFactory to MmapDirectoryFactory

Page 25: เกี่ยวกับ Apache solr 4.0

Enable http caching

Config in solrconfig.xml

Page 26: เกี่ยวกับ Apache solr 4.0

<httpCaching lastModifiedFrom="openTime" etagSeed="Solr" never304="false"> <cacheControl> max-age=43200, must-revalidate </cacheControl> !

</httpCaching>

Page 27: เกี่ยวกับ Apache solr 4.0

Q/A

Page 28: เกี่ยวกับ Apache solr 4.0