Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
ApcClassLoader
polidog
May 29, 2016
Technology
0
130
ApcClassLoader
polidog
May 29, 2016
Tweet
Share
More Decks by polidog
See All by polidog
トランザクションスクリプトは何がダメなのか?
polidog
2
1.7k
React初心者がHooksを理解するためにコードを読んでみた
polidog
0
280
object-mapperを作ってる話
polidog
0
180
2020年から始めるSymfonyフレームワーク
polidog
2
920
はじめてのモダンPHP
polidog
0
290
ソフトウェア設計は難しくない.pdf
polidog
3
750
柔軟なアプリケーションをSymfonyで作るために考えている事
polidog
1
2.8k
Symfonyのキャッシュについて
polidog
2
450
DIとLaravel
polidog
0
270
Other Decks in Technology
See All in Technology
S3とCloudWatch Logsの見直しから始めるコスト削減 / Cost saving S3 and CloudWatch Logs
shonansurvivors
0
270
IoT から見る AWS re:invent 2022 ― AWSのIoTの歴史を添えて/Point of view the AWS re:invent 2022 with IoT - with a history of IoT in AWS
ma2shita
0
290
立ち止まっても、寄り道しても / even if I stop, even if I take a detour
katoaz
0
1k
はじめてスポンサー運営PMをやってみてわかった4つのこと
andpad
2
100
API連携に伴う規制と対応 / Regulations and responses to API linkage
moneyforward
0
170
Stripe / Okta Customer Identity Cloud(旧Auth0) の採用に至った理由 〜モリサワの SaaS 戦略〜
tomuro
0
140
re:Invent2022 前後の Amazon EventBridge のアップデートを踏まえつつ、情シスの仕事をより楽しくしたい話。 / EventBridge for Information Systems Department
_kensh
2
780
OpenShift.Run2023_create-aro-with-terraform
ishiitaiki20fixer
1
360
SPA・SSGでSSRのようなOGP対応!
simo123
2
160
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
3
16k
USB PD で迎える AC アダプター大統一時代
puhitaku
2
2k
PHPのimmutable arrayとは
hnw
1
170
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
317
22k
Teambox: Starting and Learning
jrom
124
7.9k
Web Components: a chance to create the future
zenorocha
304
40k
What's new in Ruby 2.0
geeforr
336
30k
Code Review Best Practice
trishagee
50
11k
Learning to Love Humans: Emotional Interface Design
aarron
263
38k
Statistics for Hackers
jakevdp
785
210k
The Brand Is Dead. Long Live the Brand.
mthomps
48
2.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
236
1.1M
KATA
mclloyd
12
9.7k
How to name files
jennybc
47
73k
4 Signs Your Business is Dying
shpigford
171
20k
Transcript
ApcClassLoader symfony meetup #12 @polidog
ࣗݾհ • @polidog • λϏΟίϜגࣜձࣾͰSymfonyॻ͍ͯ·͢ • ࠷ۙBEARSundayษڧͯ͠·͢
ApcClassLoaderʁ
None
ApcClassLoaderʁ • web/app.phpͰίϝϯτΞτͯ͋͠Δͭ ͱࢥͬͨΒ࠷৽ͷSymfonyͩͱআ͞Εͯ ͨɾɾɾ • ͳͯ͘ಈ͘ • ͳΜͱͳ࣮͘ߦ͕ૣ͘ͳΓͦ͏
ͱΓ͋͑ͣಈ͔ͯ͠ΈΑ͏
apc(u)͕ඞཁͰ͢ɻ
brew install php70-apcu
web/app.phpΛฤू
use Symfony\Component\ClassLoader\ApcClassLoader; $apcLoader = new ApcClassLoader(sha1(__FILE__), $loader); $loader->unregister(); $apcLoader->register(true);
ܭଌͯ͠Έͨ
ܭଌ݅ • MacBook Pro (Retina, 15-inch, Mid 2014) 16GB Memory,
2.2 GHz Intel Core i7 • php7.0.6 • ϏϧτΠϯαʔόͬͯΔ • ඵؒ10ϦΫΤετΛ5ඵִؒ • vegetaͬͯݕূ https://github.com/tsenart/vegeta
ApcClassLoaderͳ͠
$ echo "GET http://localhost:8000/" | vegeta attack -rate=50 - duration=5s
| vegeta report Requests [total, rate] 50, 10.20 Duration [total, attack, wait] 4.91808977s, 4.899999865s, 18.089905ms Latencies [mean, 50, 95, 99, max] 29.650298ms, 17.586892ms, 39.421233ms, 216.898977ms, 304.779713ms Bytes In [total, mean] 230050, 4601.00 Bytes Out [total, mean] 0, 0.00 Success [ratio] 100.00% Status Codes [code:count] 200:50 Error Set:
ApcClassLoader͋Γ
$ echo "GET http://localhost:8000/" | vegeta attack -rate=50 - duration=5s
| vegeta report Requests [total, rate] 50, 10.20 Duration [total, attack, wait] 4.913044931s, 4.899999873s, 13.045058ms Latencies [mean, 50, 95, 99, max] 12.37756ms, 12.595445ms, 13.760764ms, 13.93599ms, 15.280703ms Bytes In [total, mean] 230050, 4601.00 Bytes Out [total, mean] 0, 0.00 Success [ratio] 100.00% Status Codes [code:count] 200:50 Error Set:
ApcClassLoaderૣ͍ʂʂʂ
ApcClassLoaderԿΛͯ͠ ͍Δͷ͔ʁ
ApcClassLoaderԿΛ͍ͯ͠ Δͷ͔ʁ • spl_autoload_registerʹApcClassLoaderͷloadClassϝιουΛొ͠ ͍ͯΔ͚ͩ • findFileͰapcuʹΩϟογϡ͞Ε͍ͯͳ͚ΕɺϑΝΠϧΛΩϟογϡ ͢ΔΑ͏ʹ͍ͯ͠Δ https://git.io/vrHLh •
௨ৗPSRͷComposer\Autoload\ClassLoaderͷfindFile͕࣮ߦ͞Εͯ ͍ΔͷͰ͍ɻ https://git.io/vrHLN
·ͱΊ
·ͱΊ • ApcClassLoaderૣ͍ʂ • ϓϩμΫγϣϯͰͬͨ΄͏͕ྑͦ͞͏ • ϝϞϦগͳ͍࣮ߦڥͩͱͪΐͬͱ৺ (ࠓௐΔʣ
͓͠·͍ɻ