Lekérdezések és cache a Drupalban, mennyi az annyi?

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.
Kategória: 
Leírás

A drupal.hu-n zajlik épp egy nagyon jó kis thread: Adatbázis teljesítmény optimalizálása. A szolgáltató hozzáállása magyar viszonylatban példaértékű, és ez is hozzájárult némileg a motivációhoz, hogy összeszedjem a Drupal 7 cache rendszerével kapcsolatos tapasztalataimat.

Először oszlassunk érdemes kicsit tisztázni a Drupal cache fogalmát. Egyrészt sokannál a cache fogalma kimerül abban, hogy az a pár bekapcsolható izébizé a performance oldalon.

Összességében: Drupal cache nem egyenlő a anonim felhasználóknak bekapcsolható oldal gyorstárral!

A D7-ben eleve nincsen olyan, hogy „bekapcsoljuk a cache-t”. Egy nagyon komplex, többrétű cache-rendszer van, ami az egyes elemek kiszolgálását végzi.

Ezek lehetnek dedikált elemek, mint pl a Menü gyorstár, Token registry. Vagy nem dedikált, hanem egy bármilyen modul által végzett egyszeri gyorstárazási művelet.

Még egy picit mélyebben, megpróbálom egyszerűen összefoglalni: Minden dedikált cache-nek van a Drupalon belül egy definíciója. Ez mondja meg, hogy mi történjen akkor, amikor ezt a cache-t írjuk, vagy olvassuk.
Pont ezek a definíciók teszik azt lehetővé, hogy az összes típusú cachet egységesen írhassuk, olvashassuk. Amit a modulok - illetve természetesen maga a Drupal is - a cache_get() és cache_set() függvényekkel tesznek meg.

Mire kell a cache rendszer?

Egy példa: Egy node megjelenésekor a címkék mellé ki akarunk írni egy számot, ami a node szerzőjének a node tartalomtípusába tartozó olyan tartalmak összege, amely az adott címkével el van látva.

Ez egy közepesen/kevésbé bonyolult lekérdezést jelent, amit kétféleképpen lehet megcsinálni, jól, vagy rosszul. Tegyük fel, hogy megvan a lekérdezés, ott vannak a megfelelő számok a megfelelő címkék mellett. De hogy került oda? Na ez a nem mindegy!

A legrosszabb: A címke kiírásához kapcsolódó preprocess függvénybe írt lekérdezés. Ilyenkor mondjuk egy 10 node teaserből álló, átlag 4 címkével rendelkező lista kiírásához 40!! plusz lekérdezés fog kapcsolódni!

Jó: Hmm.. És itt most viharban lettem, mert egzakt szabály erre nincsen, több módszert kellene kipróbálni, hogy kiválasszam a legjobbat az adott környezethez, feladathoz.

De 1 dolog mindegyik megoldásban benne van: Valamilyen módon fel kell építeni egy objektumot, és eltárolni cache_set()-el. A legkézenfekvőbb egy nodehoz kapcsolódó cache elem felvétele, amiből visszakapjuk a nodehoz kapcsolódó címéket és a kért számot. De meg lehet próbálni közvetlenül abba a cache-ba írni, ami a mező értékeit tárolja - szóval lehetőség van bőven.

Cache a cacheban

Ezek a cache-ok sokszor egymásba épülnek, tehát teszem azt egy nem dedikált cache elem bele fog épülni a page cache-ba (tehát a ki-bekapcsolható anomim oldalcacheba), de például a views dedikált cache-a is ugyanúgy be fog gyógyulni a page cache-ba, tehát anomymus nem fog kapni cache_get-et a viewstól. És ezért emlegettem az elején, hogy Drupalban nincs olyan, hogy "bekapcsoljuk a cache"-t. A legtöbb cache funkciót nem is lehet állítani.

Folytassuk az előző példát:

Kell egy nézet a főoldalra, ami 10 node-ot tartalmaz, benne az általunk elkészített számozott címke mezővel. Szépen beállítottunk cache_setet az eredményünkre nodeonként, és tegyük fel, hogy nem sikerült belegyógyítani a node rendereléséhez használt cache-ba. Hogyan alakulnak a lekérdezéseink bejelentkezett felhasználóknál?

Ebben az esetben 10 többletlekérdezésbe (cache_get-tel kérdezzük le az egy nodehoz tartozó címkék számait) került a 10 node megjelenítése.

És most jön a vudu: Bekapcsoljuk a views gyorstárazását. (a views szerkesztésekor az "Egyéb" szekcióban található) Ez a cache_views_data táblába menti el a lekérdezés kész html eredményét, még az a 10 többletlekérdezésünk is eltűnik, és csak akkor lesz rá szükség, ha a views ezen gyorstárát kell újraépíteni. Tehát a miáltalunk beállított cache a nodeokhoz ezáltal semlegesítődik, az eredménye beleépült a views gyorstárazás eredményébe.

Sőt! Azzal, hogy a views idő alapú gyorstárazását bekapcsoltuk, semlegesítettünk egy rakás más lekérdezéssel járó függvényt, például node_load, user_node_load, comment_node_load.

Mi ebből a tanulság? Bejelentkezett felhasználók esetében a leggyorsabban a views, panels gyorstárazással javíthatunk a teljesítményen.

Ha pedig bekapcsoljuk a gyorstárazást anonim felhasználóknak, akkor a views gyorstár is semlegesítődni fog, mert ilyenkor a cache_page táblából kapja meg a felhasználó az egész oldal renderelt htmljét.

Remélem érthető, hogy miért nem beszélhetünk "cache"-ról a Drupalban.

De akkor miért van mégis egy csomó lekérdezés bekapcsolt anonymus gyorstárazásnál?

Nagyon nem akarok belemerülni a drupal bootstrap folyamatába, de azért néhány példát kiragadnék:

  1. Mindenek előtt be kell inculde-olni a modulok php file-jait.
  2. Fel kell építeni a változókat, amelyekből például azt állapitja meg a drupal, hogy ez most front_page-e vagy nem.
  3. Fel kell építenie egy menüelem-objektumot, amely olyanokat tartalmaz, mint például a felhasználó hozzáférhet-e az adott oldalhoz, vagy nem.
  4. A legtöbb esetben álnevekkel dolgozunk. Meg kell állítani, hogy az adott álnév milyen útvonalhoz kapcsolódik, milyen tartalom tartozik hozzá.
  5. Fel kell építenie egy $user objektumot. Mert bizony, az anonim felhasználó is felhasználó, van neki neve, vannak jogosultságai, a hozzá kapcsolódó adatokat sokszor használják modulok.

És ezek még csak a core dolgai! Egy gyors mérés szerint egy frissen telepített, majdnem szűz drupal kb 30 lekérdezést produkál anonim userek page cacge kiszolgálásakor. Egy komplexebb oldal esetében ez simán felszaladhat 100 fölé.

És igen, szolgáltatóként ezt marha nehéz lekezelni. Engem két olyan oldallal dobtak ki magyar szolgáltatók, amik az én külföldi, jóval olcsóbb és ugyanúgy shared hosting szolgáltatómnak (hehe, ez egy affiliate link. :)) meg se kottyant. Drupallal nagyon könnyű kinőni egy shared hostingot, és nagyon kevés esetben van arra keret, hogy tényleg igazán elejétől a végéig teljesítményoptimalizáljuk az oldalt. Ilyenkor mindenképpen kompromisszumos megoldás kell, erre Drupal vonalon talán a Boost modul a legmegfelelőbb, ha zömében anonim oldallekérések vannak.

Hozzászólások

I read this paragraph

I read this paragraph completely on the topic of the resemblance of latest and earlier technologies, it's awesome article.

Feel free to visit my homepage; impact wrench socket set

Great post. I was checking

Great post. I was checking continuously this blog and
I am impressed! Extremely helpful info particularly the remaining part :) I
deal with such information a lot. I used to be seeking
this particular information for a long time. Thank you and best of luck.
http://www.fastrocs.org

A pertson necessarily assist

A pertson necessarily assist to make severly articles I might state.
This is the veery first time I frequented your website page and thus far?
I amazd with the analysis you made too create this particular post extraordinary.
Great task! http://www.bestcontactform.org

Hello my loved one! I want to

Hello my loved one! I want to say that thjis postt is awesome,
great wrditten and come with approximately all important infos.

I'd like to liok extra posts like this . http://www.gzceol.com

I am actually glad to read

I am actually glad to read this weblog plsts
whch includes plenty of useful information, thanks for providing such statistics.
http://www.areyoueclectic.com

It's actually a nice and

It's actually a nice and helpful piece of info.
I am satisfied that you simply shared this helpful info with us.
Please keep us informed like this. Thank you for sharing.
http://www.emremineoglu.com

Just wwant to say yourr

Just wwant to say yourr article is as surprising. The clarity in your post is just excellent and i can assume you're an expert on this
subject. Well with your permission let me tto grab yolur feed to
keep updated with forthcoming post. Thanks
a million and plewase carry on the enjoyable work.
http://www.electmarshall.com

Heey would you mind sharing

Heey would you mind sharing which blog platform you're working with?

I'm planning to start my own blog in the near future but I'm having a tough time making a
decision between BlogEngine/Wordpress/B2evolution and Drupal.
Thhe reeason I ask is because your dsign and style seems different
then most blogs and I'm looking for something completely unique.
P.S My apologies for being off-topic but I had to ask!
http://www.financialhealthsolutions.net

Heey would you mind sharing

Heey would you mind sharing which blog platform you're working with?

I'm planning to start my own blog in the near future but I'm having a tough time making a
decision between BlogEngine/Wordpress/B2evolution and Drupal.
Thhe reeason I ask is because your dsign and style seems different
then most blogs and I'm looking for something completely unique.
P.S My apologies for being off-topic but I had to ask!
http://www.financialhealthsolutions.net

I just could not go away your

I just could not go away your website prior to suggesting that I actually enjoyed the standard information a person provide for your visitors?
Is going to be back often to inspect new posts

My web blog gta online money glitch

This design is incredible!

This design is incredible! You definitely know how to keep a reader amused.
Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Fantastic job.

I really loved what you had to say, and more than that, how you presented it.
Too cool!

Also visit my web blog :: gta 5 Money glitch solo

There are several reasons she

There are several reasons she could be vomiting, and many likely her
vomiting.

Sometimes a veterinarian will put absorbable sutures there so that you do not have to visit back, but I want to check
the incision, and become sure that everything has
healed properly. For broken nails, clip the affected nail just over the area of the
vein that runs within the nail, and file any sharp edges by having an emery board.
The purple flowers of a lavender plant have a lemon-like
flavor that's pleasing to some dogs. For wintertime activities,
your accommodation is located 12 miles from Natanis Snowmobile Trails.
zimbabwe dog breeds Sometimes a veterinarian will put absorbable sutures there so that you do not have to visit back, but I want to check the incision,
and become sure that everything has healed properly. For
broken nails, clip the affected nail just over the area of
the vein that runs within the nail, and file any sharp edges by
having an emery board. The purple flowers of
a lavender plant have a lemon-like flavor that's pleasing
to some dogs. For wintertime activities, your accommodation is located 12 miles from Natanis
Snowmobile Trails.

When I originally left a

When I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox
and now each time a comment is added I recieve 4 emails with the
same comment. There has to be a way you are able to remove me from that
service? Thanks!

Feel free to surf to my page: gta 5 money glitch 1.30 (https://youtube.com)

Verify your billing and

Verify your billing and contact information, then select "paypal login" from the payment options.

You can verify a Pay - Pal

You can verify a Pay - Pal account using a Prepaid credit
card as long as you have greater than $1.

From paying your bills to buying items online, our Pay - Pal accounts.
For a seller to be protected under the Seller's Protection Policy at
Pay - Pal they are only able to ship merchandise to confirmed
Pay - Pal addresses. File a dispute through the Resolution Center if your seller doesn't grant your money back by
clicking "Dispute a Transaction" then "Item Dispute"
and deciding on the transaction under consideration when prompted.
You will get free gift cards in case you use pharmacy coupons to transfer your
prescriptions from drugstore to drugstore. paypal.com From paying your bills to buying
items online, our Pay - Pal accounts. For a seller to be protected under the Seller's Protection Policy at Pay - Pal they are only able to ship merchandise to confirmed Pay
- Pal addresses. File a dispute through the Resolution Center if your seller doesn't
grant your money back by clicking "Dispute a Transaction" then "Item Dispute" and deciding on the transaction under consideration when prompted.
You will get free gift cards in case you use pharmacy coupons
to transfer your prescriptions from drugstore to drugstore.

Touche. Sound arguments. Keep

Touche. Sound arguments. Keep up the great work.

Here is my web blog; gta money glitch

Android is often a mobile

Android is often a mobile main system developed by Google that places a great deal of focus on cloud-based solutions for data storage.

ID along with the security code inside box in the
fields and then click the "Next" button.

It's a little frustrating whenever you've got to fix an error on the.
Private messages in Facebook give a quick approach to open communication with someone.
For example, should you open Yahoo Mail in one tab on your own browser, and then open other tabs to test
the weather or perhaps the news, Yahoo will ultimately sign you out of your money due to inactivity.

When Bellsouth was acquired by AT&T, customers were still able to keep their
old Bellsouth email accounts. www.mail.yahoo.com It's a little frustrating whenever you've got to fix an error on the.
Private messages in Facebook give a quick approach to open communication with someone.
For example, should you open Yahoo Mail in one tab on your own browser,
and then open other tabs to test the weather or perhaps the
news, Yahoo will ultimately sign you out of your
money due to inactivity. When Bellsouth was acquired by AT&T, customers were still able to keep their old
Bellsouth email accounts.

Hi to all, since I am in fact

Hi to all, since I am in fact eager of reading this web
site's post to be updated on a regular basis. It includes fastidious data.

Also visit my page :: gta 5 online money glitch

Hey there! This post couldn't

Hey there! This post couldn't be written any better!

Reading through this post reminds me of my previous room mate!
He always kept chatting about this. I will forward this page to him.
Fairly certain he will have a good read. Many thanks for sharing!

my web blog; destiny Strange coins easy

Every new Blackberry cell

Every new Blackberry cell phone comes with a software
CD called Blackberry Desktop Manager. com and click on the hotmail live - kayser-immobiliendienst.de - icon on the top left
of the screen.

I loved as much as you will

I loved as much as you will receive carried out right here.
The sketch is tasteful, your authored subject matter stylish.
nonetheless, you command get got an shakiness over that you wish be delivering the
following. unwell unquestionably come more formerly
again as exactly the same nearly a lot often inside case you shield this increase.

Feel free to visit my page ... friv games tips and tricks (http://www.runwaycycling.co.uk/index.php/component/k2/itemlist/user/531370)

One with the great advantages

One with the great advantages of which has a Facebook account is that
you may locate and interact with people you've lost.
Follow the steps to develop a facebook login account should you do
not have already got one.

Keep on working, great

Keep on working, great job!

Visit my homepage; NBA 2k16 Vc Glitch

You can find excellent

You can find excellent chinese food near me bridgeport ct cuisine in vibrant South Beach in Miami, with the recently renovated Gulfstream Park in Hallandale, and even in a
unpretentious strip mall in Lauderdale Lakes. She has completed numerous writing assignments to get a number of publications that include CNN as well
as other websites.

Hola! I've been reading your

Hola! I've been reading your web site for some time now and finally got the courage to
go ahead and give you a shout out from Houston Tx! Just wanted to tell you keep up the great
job!

My blog; free fifa 16 coins mmoga

I couldn't refrain from

I couldn't refrain from commenting. Perfectly written!

Here is my web blog ... batman gifts for boy - bodilsminde.dk,

If the food is all a similar

If the food is all a similar color, it is not going to have the
same impact as multicolored food. Both food near my location; http://www.sebe.dk/?option=com_k2&view=itemlist&task=user&id=393452,
cost and high labor can plague restaurants and reduce the lenders' main point here dramatically.

Welcome to Online Casino

Welcome to Online Casino (OC)

OC is your no.1 guide for locating the best and
most innovative online casino on the Internet. We also strive to provide a variety of information related to gambling industry in order to make the internet gaming experience
more enjoyable for our patrons. We offer our website
visitors a forum where you can learn and exchange information with other gamblers.
Join today and share stories about big wins, ask questions about games,
as well as get more information about gambling in general.

If you’re having problems with a casino, you can also post on the forum to
let others know.Do you have any questions regarding anything gambling related?

Check out our new Questions and Answers page! Stop by scroll through previously asked
questions or ask your own! We are here to help you with any questions that you have.

casino,casino,casino,casino,casino

Mother and father is a

Mother and father is a celebration of right now's mom:
the girl who understands that taking care of her family also means taking care of herself.

Placing a complimentary ad on

Placing a complimentary ad on all of craigslist can be a simple solution to
advertise merchandise online.

Mastermind Group: You can

Mastermind Group: You can also be eligible for a a Mastermind Group led by some with the top Wealth Mentors for the site.
For Windows phone, i - Phone, i - Pad and Android, One - Note can be acquired so that it is
possible to update your thoughts anywhere.

edmodo login verizon wireless - www.tilburgpiekarnia.pl -

Since its founding in 1997,

Since its founding in 1997, the web DVD rental service netflix packages is continuing to grow steadily and now.

On an i - OS device, swipe

On an i - OS device, swipe your finger to the best over the comment you want to delete.
Using download instagram (ремонт-компьютера-в-москве.xn--p1ai) to abuse, harass or bully another user could also attract a
ban from Instagram.

An i - Phone may stop

An i - Phone may stop functioning normally for a lot of reasons.
If you set up an Apple i - Tunes account within the past,
these days have trouble remembering your Apple
ID, you could possibly need help finding
your Apple i - Tunes account.

get itunes login itunes.loginassistant.org

Disney World, Disneyland,

Disney World, Disneyland, Euro Disney along with
the other Disney parks provide fun-filled days to the whole family.

att.netmail att mail

The balance over a prepaid

The balance over a prepaid cell phone is stored on its SIM
card.

www.my tmobile.com tmobile bill; http://www.tincorp.com.co/?option=com_k2&view=itemlist&task=user&id=267,

Leverage the power of social

Leverage the power of social network on Linked - In by obtaining recommendations on your
own profile to develop your brand, get job offers and.

linkedin dubai office linkedin login

hotmail sign in users have

hotmail sign in users have several alternatives for retrieving deleted emails.
Configure your pop-up blocking software to take Hotmail being
a trusted site.

To make business transactions

To make business transactions easier, Pay - Pal gives a secure approach to send.

paypal mastercard debit card paypal xfer (bi-project.kz)

After access is granted, the

After access is granted, the thing is a report on contacts not currently using pinterest ideas for christmas within the left, beneath
the heading "Invite Friends," and a report on contacts already using Pinterest within the right beneath the heading "Contacts On Pinterest. Log in for your account once you've completed the registration process, and then click on the "Schedule Pins" tab within the left side of the screen.

Changing your last name once

Changing your last name once you get married can be an old tradition that
has been around for a long time. Then, either print
out or record larger than fifteen message in full on paper.

www.att.my.yahoo.com login my yahoo mail

How to Get Promoted Credits

How to Get Promoted Credits on imvu download; Cheats for IMVU Credits; How to Buy IMVU Credits With Google Checkout;
Comments You May. Changing your last name after you get married is definitely an old
tradition that may be around for some time time.

Hey I know this is off topic

Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like this for quite
some time and was hoping maybe you would have some experience with something like this.
Please let me know if you run into anything.

I truly enjoy reading your blog and I look
forward to your new updates.

Sure I had my password stolen

Sure I had my password stolen together with my passport in Jakarta,
but those were happy times, and previously,
who cared. You can do that by entering your trial product key that was given to you personally, accepting the
terms and conditions after which click.

hotmail mobile login sign hotmail inbox

As your pals add their unique

As your pals add their unique status updates, photos,
videos and. Send a note through Facebook's messaging system, log in facebook case a phone number will not be
available.

Awesome site you have here

Awesome site you have here but I was curious if you
knew of any community forums that cover the same topics talked about in this article?
I'd really love to be a part of community where I can get opinions from other knowledgeable individuals that share the same interest.

If you have any recommendations, please let me know.
Appreciate it!

My web site :: la board of pharmacy

Next, refine your quest by

Next, refine your quest by selecting only Completed and Sold items.

ebay cars for sale ebay sellers (http://www.puertoblanco.eu/?option=com_k2&view=itemlist&task=user&id=202487)

It's impressive that you are

It's impressive that you are getting thoughts from this piece
of writing as well as from our argument made at this time.

Feel free to surf to my homepage: kansas board of pharmacy

Individuals of most ages

Individuals of most ages discover the magic kingdoms to be a wonderful place to create memories
for your holidays using complete family.

restaurants near me kids eat free restaurants near me

Thanks For Sharing Such A

Thanks For Sharing Such A Great Info I Have Bookmarked It

Final Fable Hack

http://finalfablehack.com

Hozzászólás

A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.